Handle a client connection
(sock, client_addr)
| 2 | from concurrent.futures import ThreadPoolExecutor |
| 3 | |
| 4 | def echo_client(sock, client_addr): |
| 5 | ''' |
| 6 | Handle a client connection |
| 7 | ''' |
| 8 | print('Got connection from', client_addr) |
| 9 | while True: |
| 10 | msg = sock.recv(65536) |
| 11 | if not msg: |
| 12 | break |
| 13 | sock.sendall(msg) |
| 14 | print('Client closed connection') |
| 15 | sock.close() |
| 16 | |
| 17 | def echo_server(addr): |
| 18 | print('Echo server running at', addr) |