def start(self):
     global clients_queue
     print("Waiting for clients")
     while True:
         client_connection = clients_queue.get(block=True)
         print("Schedule client request")
         request_handler = RequestHandler(client_connection)
         request_handler.start()
Пример #2
0
def main():
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.bind((IP_ADDRESS, TCP_PORT))
    sock.listen(1)

    print("Waiting for connections at: {}:{}".format(IP_ADDRESS, TCP_PORT))
    while True:
        (connection, address) = sock.accept()
        print(connection)
        print("Client connected:", address)
        request_handler = RequestHandler(connection)
        request_handler.start()