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

Xu Ryan xuryans at gmail.com
Fri Dec 2 01:47:12 EST 2005

As you saying, reactor handles the events. Can i register new event
after the event loop running?

On 12/2/05, Andrew Bennetts <andrew-twisted at puzzling.org> wrote:
> On Fri, Dec 02, 2005 at 01:44:06PM +0800, Xu Ryan wrote:
> > I use the thread to make the sendCmd be called after the reactor run.
> > Because in the real application, I should start the server(reactor)
> > first, and other logic will call the sendCmd, so I can't fix it before
> > reactor.run() (as callLater(foo)). What should I do ?
> It's hard to know what you need here.  Can you elaborate more on this "other
> logic"?
> Note though that the callLater will also "make the sendCmd be called after the
> reactor run" -- although a clearer phrasing would be "make the sendCmd be called
> after the reactor starts", so I don't understand why it is inappropriate for
> you.
> Also, saying "the server(reactor)" suggests to me that you misunderstand the
> role of the reactor.  The reactor isn't your server; it's the event loop that
> runs all the networking Twisted does, servers, clients, whatever.  You don't
> want to stop and start it for each task, or have a seperate one for each task,
> it's a single object that handles the events that occur (like sockets receiving
> data) and dispatching them to the right object.
> -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