server.py
def listen_for_client(client_sock):
    """
    This function keep listening for a message from `client_sock` socket
    Whenever a message is received, broadcast it to all other connected clients
    """
    global client_sockets

    while True:
        try:
            # keep listening for a message from `client_sock` socket
            line = client_sock.recv(MESSAGE_SIZE).decode()
            print(f"listen_for_client: line=[{line}]")

        except Exception as e:
            # client no longer connected
            # remove it from the set
            print(f"[!] Error: {e}")

            print(f"Remove a socket")
            client_sockets.remove(client_sock)
            break

        # 処理は server_p に委譲します
        server_p.parse_line(line)

        # とりあえずエコー
        send_line(client_sock, line)

    This function keep listening for a message from `client_sock` socket
    Whenever a message is received, broadcast it to all other connected clients
    
This function keep listening for a message from `client_sock` socket
Whenever a message is received, broadcast it to all other connected clients
This function keep listening for a message from ` client_sock ` socket Whenever a message is received broadcast it to all other connected clients
def listen_for_client(client_sock):
    global client_sockets
    while True:
        try:
            line = client_sock.recv(MESSAGE_SIZE).decode()
            print(f"listen_for_client: line=[{line}]")
        except Exception as e:
            print(f"[!] Error: {e}")
            print(f"Remove a socket")
            client_sockets.remove(client_sock)
            break
        server_p.parse_line(line)
        send_line(client_sock, line)
def listen_for_client ( client_sock ) : global client_sockets while True : try : line = client_sock . recv ( MESSAGE_SIZE ) . decode ( ) print ( f"listen_for_client: line=[{line}]" ) except Exception as e : print ( f"[!] Error: {e}" ) print ( f"Remove a socket" ) client_sockets . remove ( client_sock ) break server_p . parse_line ( line ) send_line ( client_sock , line )
This function keep listening for a message from `client_sock` socket
Whenever a message is received, broadcast it to all other connected clients
This function keep listening for a message from ` client_sock ` socket Whenever a message is received broadcast it to all other connected clients
"""
    This function keep listening for a message from `client_sock` socket
    Whenever a message is received, broadcast it to all other connected clients
    """ # keep listening for a message from `client_sock` socket # client no longer connected # remove it from the set # 処理は server_p に委譲します # とりあえずエコー
client_sock