MCPcopy Index your code
hub / github.com/dabeaz/python-cookbook / echo_server

Function echo_server

src/12/how_to_create_a_thread_pool/example1.py:17–25  ·  view source on GitHub ↗
(addr)

Source from the content-addressed store, hash-verified

15 sock.close()
16
17def echo_server(addr):
18 print('Echo server running at', addr)
19 pool = ThreadPoolExecutor(128)
20 sock = socket(AF_INET, SOCK_STREAM)
21 sock.bind(addr)
22 sock.listen(5)
23 while True:
24 client_sock, client_addr = sock.accept()
25 pool.submit(echo_client, client_sock, client_addr)
26
27echo_server(('',15000))

Callers 1

example1.pyFile · 0.70

Calls 2

acceptMethod · 0.80
submitMethod · 0.80

Tested by

no test coverage detected