[PyQt] QtNetwork newbie question
John Stewart
john.stewart at insomniafilm.com
Sun Mar 18 20:40:49 GMT 2012
Hi all,
I am trying to write a distributed render manager. The sever would be waiting for incoming connections (other CPUs wishing to be part of the machine pool) and then issue commands to be run on those other CPUs when a job is run in the manager via a user.
So far, this is what I am using to listen for connections and return their.
class Main(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
#init UI
self.ui=Ui_rndr_Manager()
self.ui.setupUi(self)
#init Network
self.tcpServer = QtNetwork.QTcpServer()
self.tcpServer.listen(address=QtNetwork.QHostAddress.Any, port=5000)
self.connect(self.tcpServer, QtCore.SIGNAL("newConnection()"), self.newConnectionArrives )
def newConnectionArrives(self):
self.sock = self.tcpServer.nextPendingConnection()
self.connect(self.sock, QtCore.SIGNAL("readyRead()"), self.tcpSocketReadyReadEmitted)
def tcpSocketReadyReadEmitted(self):
data = str(self.sock.readAll())
print data
When I try and have two separate clients connect, the first client is ignored and only the second's data is received. Am I going about this the wrong way for multiple client connections or is there just something I am missing?
Thanks!
John
More information about the PyQt
mailing list