Server¶
rpyc plug-in server (threaded or forking)
-
class
rpyc.utils.server.Server(service, hostname='', ipv6=False, port=0, backlog=10, reuse_addr=True, authenticator=None, registrar=None, auto_register=None, protocol_config={}, logger=None, listener_timeout=0.5, socket_path=None)[source]¶ Base server implementation
Parameters: - service – the
serviceto expose - hostname – the host to bind to. Default is IPADDR_ANY, but you may
want to restrict it only to
localhostin some setups - ipv6 – whether to create an IPv6 or IPv4 socket. The default is IPv4
- port – the TCP port to bind to
- backlog – the socket’s backlog (passed to
listen()) - reuse_addr – whether or not to create the socket with the
SO_REUSEADDRoption set. - authenticator – the Authenticators to use. If
None, no authentication is performed. - registrar – the
registrarto use. IfNone, a defaultrpyc.utils.registry.UDPRegistryClientwill be used - auto_register – whether or not to register using the registrar. By default, the server will attempt to register only if a registrar was explicitly given.
- protocol_config – the
configuration dictionarythat is passed to the RPyC connection - logger – the
loggerto use (of the built-inloggingmodule). IfNone, a default logger will be created. - listener_timeout – the timeout of the listener socket; set to
Noneto disable (e.g. on embedded platforms with limited battery)
- service – the
-
class
rpyc.utils.server.OneShotServer(service, hostname='', ipv6=False, port=0, backlog=10, reuse_addr=True, authenticator=None, registrar=None, auto_register=None, protocol_config={}, logger=None, listener_timeout=0.5, socket_path=None)[source]¶ A server that handles a single connection (blockingly), and terminates after that
Parameters: see
Server
-
class
rpyc.utils.server.ThreadedServer(service, hostname='', ipv6=False, port=0, backlog=10, reuse_addr=True, authenticator=None, registrar=None, auto_register=None, protocol_config={}, logger=None, listener_timeout=0.5, socket_path=None)[source]¶ A server that spawns a thread for each connection. Works on any platform that supports threads.
Parameters: see
Server
-
class
rpyc.utils.server.ThreadPoolServer(*args, **kwargs)[source]¶ This server is threaded like the ThreadedServer but reuses threads so that recreation is not necessary for each request. The pool of threads has a fixed size that can be set with the ‘nbThreads’ argument. The default size is 20. The server dispatches request to threads by batch, that is a given thread may process up to request_batch_size requests from the same connection in one go, before it goes to the next connection with pending requests. By default, self.request_batch_size is set to 10 and it can be overwritten in the constructor arguments.
Contributed by @sponce
Parameters: see
Server