MCPcopy Create free account
hub / github.com/dabeaz-course/python-mastery / echo_handler

Function echo_handler

Solutions/8_6/asyncserver.py:64–71  ·  view source on GitHub ↗
(client, address)

Source from the content-addressed store, hash-verified

62 tasks.append(handler(client, addr))
63
64async def echo_handler(client, address):
65 print('Connection from', address)
66 while True:
67 data = await client.recv(1000)
68 if not data:
69 break
70 await client.send(b'GOT:' + data)
71 print('Connection closed')
72
73if __name__ == '__main__':
74 tasks.append(tcp_server(('',25000), echo_handler))

Callers

nothing calls this directly

Calls 2

recvMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected