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

Function echo_handler

src/11/simple_authentication_of_clients/server.py:6–14  ·  view source on GitHub ↗
(client_sock)

Source from the content-addressed store, hash-verified

4secret_key = b'peekaboo'
5
6def echo_handler(client_sock):
7 if not server_authenticate(client_sock, secret_key):
8 client_sock.close()
9 return
10 while True:
11 msg = client_sock.recv(8192)
12 if not msg:
13 break
14 client_sock.sendall(msg)
15
16def echo_server(address):
17 s = socket(AF_INET, SOCK_STREAM)

Callers 1

echo_serverFunction · 0.70

Calls 3

server_authenticateFunction · 0.90
closeMethod · 0.45
recvMethod · 0.45

Tested by

no test coverage detected