[Twisted-Python] Perspective Broker
le dahut
le.dahut at laposte.net
Mon Nov 27 02:54:48 MST 2006
Hello,
Using PB, I've setup a system where clients can control other clients in
this way :
client1 executes "remote_do_something" on server1 with "ip_client2" as
argument.
Then server1 connects to client2 and executes "remote_smthng" on it.
code is like this :
- client1:
"""
factory = pb.PBClientFactory()
reactor.connectTCP(ip_server1, port, factory)
d = factory.getRootObject()
d.addCallback(lambda object: object.callRemote("do_something", ip_client2))
d.addCallback(client1_call_b)
d.addErrback(client1_err_b)
"""
- server1:
"""
def remote_do_something(ip):
factory = pb.PBClientFactory()
reactor.connectTCP(ip_client2, port, factory)
d = factory.getRootObject()
d.addCallback(lambda object: object.callRemote("smthng"))
d.addCallback(server1_call_b)
d.addErrback(server1_err_b)
"""
- client2:
"""
def remote_smthng():
<code>
return "Ok, everything's done"
"""
How can client1 get client2's answer ?
Thanks
More information about the Twisted-Python
mailing list