def listenerThread(self): listener = TCPSocket() listener.listen("0.0.0.0", 32102) while True: requestSocket = listener.accept() requestHandlerThread = Thread(target=self.receiverThread, args=(requestSocket,)) requestHandlerThread.start()
def responseListenerThread(self): while True: listenerSocket = TCPSocket() listenerSocket.listen("0.0.0.0", DEFAULT_DISCOVERY_PORT) newConnection = listenerSocket.accept() discoveredThread = threading.Thread(target=self.peerDiscoveredThread, args=(newConnection,)) discoveredThread.start()