# 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)

  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 `registrar` to use. If `None`, a default `rpyc.utils.registry.UDPRegistryClient` 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-in `logging` module). If `None`, 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)

  `close`()

    Closes (terminates) the server and all of its clients. If applicable, also unregisters from the registry server

  `fileno`()

    returns the listener socket’s file descriptor

  `accept`()

    accepts an incoming socket connection (blocking)

  `start`()

    Starts the server (blocking). Use `close()` to stop

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)

  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)

  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)

  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`

  `close`()

    closes a ThreadPoolServer. In particular, joins the thread pool.

class `rpyc.utils.server.``ForkingServer`(*args, **kwargs)

  A server that forks a child process for each connection. Available on POSIX compatible systems only.

  Parameters: see `Server`