tcp_socket/_examples_/tcp_socket__tcp.py

22 lines
444 B
Python

import sys # nopep8
sys.path.append('../..') # nopep8
import time
import tcp_socket
import report
def mirror_callback(tcp):
tcp.send(tcp.receive())
report.default_logging_config()
# Start the server
s = tcp_socket.tcp_server('127.0.0.1', 17000)
s.register_callback(mirror_callback)
# Start the clien
c = tcp_socket.tcp_client('127.0.0.1', 17000)
c.send(b'abc')
print('The Client received: %s' % repr(c.receive()))