On Fri, 15 May 2009 11:11:58 +0300, coder_gus <[email protected]> wrote:
>Hi,
>I have a pb client and a tcp server. How can I make the server start
>only after/if the client started?
In general, the answer to "how do I do X when Y?" is "Put the code to do X
in the callback that tells you Y has happened."
So, for example, if you're using PBClientFactory.login, you might add a
callback to the Deferred it returns which starts your TCP server. ie,
f = PBClientFactory(...)
d = f.login(...)
def cbLoggedIn(avatar):
reactor.listenTCP(...)
...
d.addCallback(cbLoggedIn)
...
reactor.connectTCP(..., f)
reactor.run()
Jean-Paul
_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python