项目作者: TiandaLiu

项目描述 :
TCP server and client
高级语言: Python
项目地址: git://github.com/TiandaLiu/tcp-server-client.git
创建时间: 2020-02-11T03:17:53Z
项目社区:https://github.com/TiandaLiu/tcp-server-client

开源协议:

下载


TCP Server & Client

Instruction

To start the server, run following code in command line tools (terminal):

  1. $ python3 EchoServer.py <portNumber>
  2. (ex. python3 EchoServer.py 8880)

To start the client, run following code in command line tools (terminal):

  1. $ python3 EchoClient.py <hostName> <portNumber>
  2. (ex. python3 EchoClient.py linux1.cs.uchicago.edu 8880)

Demo

Setup server:

  1. $ python3 EchoServer.py 8080
  2. The server at TIANDAs-MacBook-Pro.local with port number: 8080 is ready to receive:

Setup client:

  1. $ python3 EchoClient.py 127.0.0.1 8080

Send message from client to server:

  1. $ python3 EchoClient.py 127.0.0.1 8080
  2. > Hello Server!
  3. > Message reveived from 127.0.0.1:8080: hello

Reveive message from client and send response to client:

  1. $ python3 EchoServer.py 8080
  2. > The server at TIANDAs-MacBook-Pro.local with port number: 8080 is ready to receive:
  3. > New Connection!
  4. > Reveived message: Hello Server!
  5. > Responsed message: Hello Server!