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

Andrew Bennetts andrew-twisted at puzzling.org
Fri Dec 2 00:53:51 EST 2005

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

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

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.


More information about the Twisted-Python mailing list