(client, address)
| 58 | tasks.append(handler(client, addr)) |
| 59 | |
| 60 | def echo_handler(client, address): |
| 61 | print('Connection from', address) |
| 62 | while True: |
| 63 | data = yield from client.recv(1000) |
| 64 | if not data: |
| 65 | break |
| 66 | yield from client.send(b'GOT:' + data) |
| 67 | print('Connection closed') |
| 68 | |
| 69 | if __name__ == '__main__': |
| 70 | tasks.append(tcp_server(('',25000), echo_handler)) |