[Twisted-Python] How can a tcp client connect with multi servers?

Xu Ryan xuryans at gmail.com
Fri Dec 2 02:25:48 EST 2005

But when reactor.run() is called, the program lock here. and the codes
after "reactor.run()" are not been called until reactor is stop.

On 12/2/05, Andrew Bennetts <andrew-twisted at puzzling.org> wrote:
> On Fri, Dec 02, 2005 at 02:47:12PM +0800, Xu Ryan wrote:
> > As you saying, reactor handles the events. Can i register new event
> > after the event loop running?
> Absolutely.  You can, for instance, call connectTCP as many times as you like
> while the event loop is running to establish multiple client connections, which
> may be concurrent.
> You can call listenTCP at any time too, if during the course of running the code
> needs to start listening on another TCP port.
> And so on.  Most of the reactor methods can be called while the reactor is
> running, with a couple of obvious exceptions (e.g. you can't call reactor.run).
> Many of the other actions you can take in a Twisted program, like writing to or
> disconnecting a transport, are also at some level instructing the reactor to do
> something, and again this happens inside the event loop.
> -Andrew.
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Xu Ryans

More information about the Twisted-Python mailing list