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

Xu Ryan xuryans at gmail.com
Thu Dec 1 04:48:12 EST 2005

I meet another problem. After i create some ClientCreate instance and
let the reactor run , it works ok.
But how could I send message when reactor is running? Because there
are not only one services that twisted provide. And when I need send
the messages i have told above , perhaps there are other service
running , using the same reactor(becaus it's global), and obviously I
can't stop it , re-create ClientCreator, then call reactor.run() to
send the message.

On 12/1/05, Andrew Bennetts <andrew-twisted at puzzling.org> wrote:
> [please don't top-post]
> On Thu, Dec 01, 2005 at 04:22:03PM +0800, Xu Ryan wrote:
> > Does Client Creator load protocol's "connectionMade" automatically ,
> > same as factory?
> ClientCreator is just a shortcut for creating the factory and so forth manually.
> The event handlers (connectionMade, dataReceived, connectionLost) on the
> resulting protocol will be invoked as normal.
> So yes, connectionMade will be called (assuming a connection is made, if the
> connection fails the Deferred returned from ClientCreator.connectTCP will have
> an error instead), but this isn't really anything to do with ClientCreator: once
> the connection is established, ClientCreator is not involved.
> Experimenting with the example at
> http://twistedmatrix.com/projects/core/documentation/howto/clients.html#auto2
> might be a good idea.
> The source code for ClientCreator is quite simple.  Perhaps it would be worth
> reading and understanding that, so you can see how little code is involved.  The
> definition of ClientCreator is found in twisted/internet/protocol.py:
>     http://svn.twistedmatrix.com/cvs/trunk/twisted/internet/protocol.py?view=auto&rev=14194
> -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