Phil Thompson schreef:
I've now instantiated a QTcpServer, which "creates" a socket for an incoming connection (QTcpServer.nextPendingConnection(), that is).On Sat, 21 Nov 2009 17:19:00 +0100, Nick Gaens <[email protected]> wrote:Hello all, Both clients have such a server instance, since they both should be able to connect to each other. But still, the QTcpSocket.connectToHost() invocation doesn't do a thing. I'm starting to think this is some bug / error in PyQt4 itself instead of in my code. The C++-Qt4 Fortune Server + Client example runs flawlessly between the two machines, so there are no network blocks or something like that. Also, the C++-code has the same logical flow as my code below. ---------------------------- def __init__(self): self.server = QtNetwork.QTcpServer(self) self.server.serverPort = 55555 self.server.newConnection.connect(self.clientConnecting) self.server.listen() # defaults to QHostAddress.Any def clientConnecting(self): # used by the "server" if self.server.hasPendingConnections(): connectingClient = self.server.nextPendingConnection() connectingClient.readyRead.connect(self.receiveData) def connectToClient(self, ip): # used by the "client" socket = QtNetwork.QTcpSocket() socket.readyRead.connect(self.receiveData) socket.connectToHost(QtNetwork.QHostAddress(ip), 55555) # ip of server if socket.waitForConnected(5000): print "Connected!" ---------------------------- I *really* do not understand why this is *not* working.. Nick |
_______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
