[Twisted-Python] How to make a service dependent of another?

Christopher Armstrong radix at twistedmatrix.com
Fri May 15 10:09:30 EDT 2009


On Fri, May 15, 2009 at 4:11 AM, coder_gus <coder_gus at lavabit.com> wrote:
> Hi,
> I have a pb client and a tcp server. How can I make the server start
> only after/if the client started?

Basically, you want to call listenTCP in one of the callbacks that get
invoked when a client is successfully connected. There are a few of
these:

* the connectionMade method of your client protocol
* the clientConnectionMade method of your client factory
* the deferred that's returned from ClientCreator, if you're using it.

Depending on your situation and the factoring that you want, any of
these could be the most appropriate.

-- 
Christopher Armstrong
http://radix.twistedmatrix.com/
http://planet-if.com/
http://canonical.com/




More information about the Twisted-Python mailing list