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: except OSError as msg:
sock.close() sock.close()
return return
conn, addr = sock.accept() while True:
with conn: conn, addr = sock.accept()
LOGGER.info("Connected by %s", addr) with conn:
while True: LOGGER.info("Connected by %s", addr)
data = conn.recv(1024) while True:
if not data: break data = conn.recv(1024)
conn.send(data) if not data: break
conn.send(data)
if __name__ == "__main__": if __name__ == "__main__":
main() main()