[Twisted-Python] waiting for results from tcp
nimag at rogers.com
Thu Oct 16 13:47:59 EDT 2008
I have a server which can handle multiple connections. At any given time, I want to send out a ping to see who is still listening to this server.
For this I scan through my list of ip's and send out a msg with
factory = ClientFactory()
factory.protocol = caller
factory.message = self.message
factory.alive = 0
reactor.connectTCP(self.ip, self.port, factory)
and wait on the response. This is done from within an application daemon, so no reactor.run() is required.
How can I send a message out and wait for the response before proceeding? I tried using deferreds a bunch of different ways but I can't seem to get it going.
Oh and I should clarify I want the response to be in the original stream, not in the thread created by connectTCP/dataReceived/etc...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python