Created
January 23, 2020 10:32
-
-
Save BMU-Verlag/ffccfeceb619b7319fab850c6baf105c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for socket in read_sockets: | |
if socket == server_socket: | |
client_socket, client_address = server_socket.accept() | |
all_sockets.append(client_socket) | |
print(f'Established connection to {client_address[0]}:{client_address[1]}') | |
else: | |
message = receive(socket) | |
if not message: | |
print(f'{client_socket.getpeername()[0]}:{client_socket. getpeername() [1]} closed the connection') | |
sockets_list.remove(socket) | |
continue | |
broadcast(socket, message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment