Server
rpyc plug-in server (threaded or forking)
- class rpyc.utils.server.Server(service, hostname=None, ipv6=False, port=0, backlog=4096, reuse_addr=True, authenticator=None, registrar=None, auto_register=None, protocol_config=None, logger=None, listener_timeout=0.5, socket_path=None)[source]
Base server implementation
- Parameters:
service – the
Service
to exposehostname – the host to bind to. By default, the ‘wildcard address’ is used to listen on all interfaces. if not properly secured, the server can receive traffic from unintended or even malicious sources.
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 usedauto_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 connectionlogger – 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)
- class rpyc.utils.server.OneShotServer(service, hostname=None, ipv6=False, port=0, backlog=4096, reuse_addr=True, authenticator=None, registrar=None, auto_register=None, protocol_config=None, 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=None, ipv6=False, port=0, backlog=4096, reuse_addr=True, authenticator=None, registrar=None, auto_register=None, protocol_config=None, 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=None, ipv6=False, port=0, backlog=4096, reuse_addr=True, authenticator=None, registrar=None, auto_register=None, protocol_config=None, logger=None, listener_timeout=0.5, socket_path=None)[source]
gevent based Server. Requires using
gevent.monkey.patch_all()
.