i really don't understand what you're trying to do, but keep in mind that
you get a service instance per connection.
therefore, setting self.p on conn1 and getting it from conn2 won't work.
try putting that in a global variable or something, e.g,
the_ip = None
class MyService(rpyc.Service):
def exposed_get_ip(self):
return the_ip
def exposed_set_ip(self, ip):
the_ip = ip
-tomer
-----------------------------------------------------------------
*Tomer Filiba*
tomerfiliba.com <http://www.facebook.com/tomerfiliba>
<http://il.linkedin.com/in/tomerfiliba>
On Thu, Nov 20, 2014 at 10:54 AM, <[email protected]> wrote:
> Hi,
>
> I'm not able to solve this problem. I have two clients ( VMachine1 and
> VMachine2) and an service on VM3. How can i set a parameter from VM1 and
> get it with VM2?
>
> (each client to service works perfectly. but so i create two objects).
>
> Thx.
>
> ------- service -------:
> import rpyc
>
> class MyService(rpyc.Service):
>
>
> def on_connect(self):
> pass
>
>
> def on_disconnect(self):
> pass
>
>
> def exposed_get_ip(self):
> return self.ip
>
>
> def exposed_set_ip(self, ip):
> self.ip = ip
>
>
> if __name__ == "__main__":
>
> from rpyc.utils.server import ThreadedServer
> t = ThreadedServer(MyService, port = 18862)
> t.start()
>
>
>
> ------- client1 -------: SET
> >>> import rpyc
> >>> c1 = rpyc.connect('host', 18862)
> >>> c1.root.exposed_set_ip( '192.168.0.0' )
>
>
>
> ------- client2 -------: GET
> >>> import rpyc
> >>> c2 = rpyc.connect('host', 18862)
> >>> c2.root.exposed_get_ip( )
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "rpyc" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
---
You received this message because you are subscribed to the Google Groups
"rpyc" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.