Skip to content

Instantly share code, notes, and snippets.

@BMU-Verlag
Created January 23, 2020 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BMU-Verlag/9afe4ab634b4020564c7ba0f818030e6 to your computer and use it in GitHub Desktop.
Save BMU-Verlag/9afe4ab634b4020564c7ba0f818030e6 to your computer and use it in GitHub Desktop.
try:
message = receive(socket)
if not message:
print(f'{client_socket.getpeername()[0]}:{client_socket. getpeername()[1]} closed the connection')
all_sockets.remove(socket)
continue
broadcast(socket, message)
except ConnectionResetError as e:
all_sockets.remove(socket)
print('Client forcefully closed the connection')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment