Handle more connections after a client disconnects

This commit is contained in:
Eli Ribble 2024-08-01 14:39:04 -07:00
parent 99cc052f6f
commit fbdf2a6ef1
1 changed files with 8 additions and 7 deletions

View File

@ -33,13 +33,14 @@ def bind_socket(family, type_, proto, canonname, sockaddr):
except OSError as msg:
sock.close()
return
conn, addr = sock.accept()
with conn:
LOGGER.info("Connected by %s", addr)
while True:
data = conn.recv(1024)
if not data: break
conn.send(data)
while True:
conn, addr = sock.accept()
with conn:
LOGGER.info("Connected by %s", addr)
while True:
data = conn.recv(1024)
if not data: break
conn.send(data)
if __name__ == "__main__":
main()