[LINUX] I tried server-client communication using tmux

Introduction

This article is written by a student who is doing JS or something instead of a memo. Don't expect the content.

1. What is server-client communication in the first place?

A communication method performed by the server of the computer that provides the service and the client of the computer that receives the service. The network is connected to the client radially from the server. P2P communication is often contrasted with this, and in the P2P type, all computers have both a server and a client.

2. Start tmux

This time it will be done on Ubuntu, so I will start the virtual environment with iTerm2.

Where it started

  1. Virtual Box 2.Vagrant I use Ubuntu in a virtual environment that uses two software. cd ~/vagrant/ubuntu vagrant up vagrant ssh

Move to the directory where Ubuntu is installed. vagrant up is a command to start Ubuntu installed on a virtual PC, and vagrant ssh connects to SSH with the Vagrant virtual machine set.

Start tmux when the console starts. tmux Here is a summary of simple tmux commands.

command meaning Where to write
tmux Start-up console
control+b→d Leave the virtual terminal Virtual terminal
tumux a Connect to a virtual terminal console
control+b→c Window creation Virtual terminal
control+b → number Move window to numbers Virtual terminal
control+b→p Move to previous number Virtual terminal
control+b→n Move to a later number Virtual terminal
control+b→x close the window Virtual terminal

3. Use tmux for server-client communication

First, when you have two windows, write the following contents in one window.

; do (echo "Thank you!") | nc -l 8000 ; done


In order to perform a loop called while, the contents of the loop are described in while:; do and done. nc in while is called nc command, this time nc -l Port number It is set to listen mode with -l and is listening on the specified port number. In this case, when there is an access, echo is displayed as Thank you !.

Next, write the following on the other side.

telnet 127.0.0.1 8000


127.0.01 is the IP address that identifies you. In this case, telnet is used to access port 8000 of the IP address. Telnet is a command to access a remote computer and start a terminal session. It seems that alternative protocols such as ssh are often used for security reasons.

When I executed the above description, the contents of echo were displayed, so I was able to communicate between the server and client !!

4. Then try chatting with tmux

Let's chat using Transfer nc command file (FTP). Server side nc -l -p Port number File name Connection side

I will describe the above. This time on the server side nc -l -p 8000 On the connection side

nc 127.0.01 8000


 Was described.
 It is successful if you write sentences on the console and the sentences are written on the server side and the connection side. Thank you for your hard work.




### What is an IP address?
 An IP address is a 32-bit size Internet address that consists of four integers from 0 to 255.
 IP is an abbreviation for Internet Protocol.


Recommended Posts

I tried server-client communication using tmux
I tried using parameterized
I tried using mimesis
I tried using anytree
I tried using aiomysql
I tried using Summpy
I tried using coturn
I tried using Pipenv
I tried using matplotlib
I tried using "Anvil".
I tried using Hubot
I tried using ESPCN
I tried using openpyxl
I tried using Ipython
I tried using PyCaret
I tried using cron
I tried using ngrok
I tried using face_recognition
I tried using Jupyter
I tried using PyCaret
I tried using Heapq
I tried using doctest
I tried using folium
I tried using jinja2
I tried using folium
I tried using time-window
I tried using easydict (memo).
I tried face recognition using Face ++
I tried using Random Forest
I tried using BigQuery ML
I tried using Amazon Glacier
I tried using git inspector
[Python] I tried using OpenPose
I tried using magenta / TensorFlow
I tried using AWS Chalice
I tried using Slack emojinator
I tried using Rotrics Dex Arm # 2
I tried using Rotrics Dex Arm
I tried using GrabCut of OpenCV
I tried using Thonny (Python / IDE)
I tried reinforcement learning using PyBrain
I tried deep learning using Theano
Somehow I tried using jupyter notebook
I tried SMTP communication with Python
[Kaggle] I tried undersampling using imbalanced-learn
I tried shooting Kamehameha using OpenPose
I tried using the checkio API
[Python] I tried using YOLO v3
I tried asynchronous processing using asyncio
I tried using Amazon SQS with django-celery
I tried using Azure Speech to Text.
I tried using Twitter api and Line api
I tried playing a ○ ✕ game using TensorFlow
I tried using YOUTUBE Data API V3
I tried using Selenium with Headless chrome
I tried drawing a line using turtle
[Kaggle] I tried ensemble learning using LightGBM
I tried using PyEZ and JSNAPy. Part 2: I tried using PyEZ
I tried using Bayesian Optimization in Python
I tried to classify text using TensorFlow
I tried using Selective search as R-CNN