1) it depends on you. the client and server's services are decoupled; you
can connect a VoidService client to a MyService server, which only means
the server won't be able to invoke functions on the client. on the other
hand, if you pass an object from the client to the server, the server will
be able to use it. what will it be able to use - depends on the config. by
default, only `exposed_` attributes and "safe" magic methods are allowed,
but you can change it via the configuration.

2) if you're using the classic rpyc (SlaveService), you can use
conn.root.getconn()<http://rpyc.sourceforge.net/api/core_service.html#rpyc.core.service.SlaveService.exposed_getconn>,
which returns the other party's connection. from this connection, you can
dig up ._config["logger"] to get hold of the logger instance. if you're not
using classic mode, you can implement an exposed method, say
exposed_get_logger, to do the trick. anyway, why do you need to get the
other party's logger? loggers are normally configured once and then used by
the server to log exceptions - it's for diagnostic purposes, not everyday
use.

-----------------------------------------------------------------

*Tomer Filiba*
tomerfiliba.com     <http://www.facebook.com/tomerfiliba>
<http://il.linkedin.com/in/tomerfiliba>



On Sun, Sep 2, 2012 at 2:15 PM, ben <[email protected]> wrote:

> I have a class that inherits from *rpyc.Service* (lets call it MyService)
> and i initiate a server via the command 
> *rpyc.utils.server.ThreadServer(MyServer,
> port)*.
>
> I start the server and then connect to it from the client using the
> command: rpyc.connect(server_ip, port).
>
> I now have 2 questions:
> 1) if i add/change default params in the config_dict, do i need to add
> them on both the client and server end?
> 2) if i add a logger instance at the client end via the key 'logger', how
> do i access it at the server end? do i have to add something to the
> "on_connect" method of MyService?
>
> thx
>

Reply via email to