Thanks for your reply. I think the first call of reactor.run() does return, because there is a callback that calls reactor.stop(). naoya Uwe C. Schroeder wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
The problem you have is that reactor.run() never returns. It's the main-loop.
On Tuesday 21 September 2004 09:10 pm, Naoya Maruyama wrote:
Hello,
I'm new to Twisted and want to use the Perspective Broker. I read the howto pages of the web site, but I coundn't find answer of my question.
I'm testing the echo server/clinet (pbsimpleserver.py and pbsimpleclient.py). I can successfully run them, but if I change the client to the following, the result seems strange.
--- from twisted.spread import pb from twisted.internet import reactor from twisted.python import util
factory = pb.PBClientFactory() reactor.connectTCP("localhost", 8789, factory)
def test(): d = factory.getRootObject() d.addCallback(lambda object: object.callRemote("echo", "hello network")) d.addCallback(lambda echo: 'server echoed: '+echo) d.addErrback(lambda reason: 'error: '+str(reason.value)) d.addCallback(util.println) d.addCallback(lambda _: reactor.stop()) reactor.run() return
# calls test twice test() test() ---
If I execute this client code, the client doesn't finish running. And the server prints out "echoing: hello network" only once. So, it seems that the client failed to get the root object, or to call the remote method. What's the problem? I can't get the root object multiple times?
Thanks,
naoya
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
- -- UC
- -- Open Source Solutions 4U, LLC 2570 Fleetwood Drive Phone: +1 650 872 2425 San Bruno, CA 94066 Cell: +1 650 302 2405 United States Fax: +1 650 872 2417 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQFBUQDajqGXBvRToM4RAnclAJ9ByucFmmEwRwEFSWax29p4jqh+BQCgt5NM WY8m9UwJRGFCCtjSa+r0SV8= =M2T2 -----END PGP SIGNATURE-----
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python