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
Service
to expose - hostname – the host to bind to. Default is IPADDR_ANY, but you may
want to restrict it only to
localhost
in 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_REUSEADDR
option set. - authenticator – the Authenticators to use. If
None
, no authentication is performed. - registrar – the
RegistryClient
to use. IfNone
, a defaultUDPRegistryClient
will 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 dictionary
that is passed to the RPyC connection - logger – the
logger
to use (of the built-inlogging
module). IfNone
, a default logger will be created. - listener_timeout – the timeout of the listener socket; set to
None
to 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
-
class
rpyc.utils.server.
ForkingServer
(*args, **kwargs)[source]¶ A server that forks a child process for each connection. Available on POSIX compatible systems only.
Parameters: see
Server
-
class
rpyc.utils.server.
GeventServer
(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]¶ gevent based Server. Requires using
gevent.monkey.patch_all()
.