[Twisted-Python] Connecting to multiple servers

Gerrat Rickert grickert at coldstorage.com
Wed Jul 8 09:22:54 EDT 2009

>-----Original Message-----
>From: twisted-python-bounces at twistedmatrix.com [mailto:twisted-python-
>bounces at twistedmatrix.com] On Behalf Of Antonio Beamud Montero
>Sent: Wednesday, July 08, 2009 4:42 AM
>To: Twisted general discussion
>Subject: Re: [Twisted-Python] Connecting to multiple servers


>Ok, but when I use reactor.connectTCP no deferred is returned.. How I
>can stop the reactor when all connections has finished?

...it would be helpful if you provided an actual example 
(your example did not use a "reactor.connectTCP");
but in general terms, if you're connecting to multiple servers
and want to wait till all connections are finished, you'll need to 
track the connections, and call reactor.stop() once the last
connection is closed.

...so, using the example at:
- just call reactor.stop() in connectionLost method
after all connections have been lost


More information about the Twisted-Python mailing list