[Twisted-Python] waiting for results from tcp

Nima Ghanavatian nimag at rogers.com
Thu Oct 16 11:47:59 MDT 2008


Hi,

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...

thanks,

Nima
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20081016/d3430820/attachment.html>


More information about the Twisted-Python mailing list