123456789101112131415161718192021222324 |
- import sys
- sys.path.append('../..')
-
- import report
- import tcp_socket
- import time
-
- def mirror_callback(tcp):
- tcp.send(tcp.receive())
-
-
- report.stdoutLoggingConfigure(log_name_lvl=[('root', 'DEBUG'), ])
- s = tcp_socket.tcp_server('127.0.0.1', 17000)
- s.register_callback(mirror_callback)
-
- i = 0
- while not s.is_connected() and i <= 10:
- i += 1
- time.sleep(.1) # wait for a connection
-
- i = 0
- while s.is_connected() and i <= 10:
- i += 1
- time.sleep(.1) # wait for disconnect
|