Registry
RPyC Registry Server maintains service information on RPyC services for Service Registry and Discovery patterns. Service Registry and Discovery patterns solve the connectivity problem for communication between services and external consumers. RPyC services will register with the server when auto_register
is True
.
Service registries such as Avahi and Bonjour are alternatives to the RPyC Registry Server. These alternatives do no support Windows and have more restrictive licensing.
Refer to rpyc/scripts/rpyc_registry.py
for more info.
- class rpyc.utils.registry.RegistryServer(listenersock, pruning_timeout=None, logger=None, allow_listing=False)[source]
Base registry server
- on_service_added(name, addrinfo)[source]
called when a new service joins the registry (but not on keepalives). override this to add custom logic
- class rpyc.utils.registry.UDPRegistryServer(host='0.0.0.0', port=18811, pruning_timeout=None, logger=None, allow_listing=False)[source]
UDP-based registry server. The server listens to UDP broadcasts and answers them. Useful in local networks, were broadcasts are allowed
- class rpyc.utils.registry.TCPRegistryServer(host='0.0.0.0', port=18811, pruning_timeout=None, logger=None, reuse_addr=True, allow_listing=False)[source]
TCP-based registry server. The server listens to a certain TCP port and answers requests. Useful when you need to cross routers in the network, since they block UDP broadcasts
- class rpyc.utils.registry.RegistryClient(ip, port, timeout, logger=None)[source]
Base registry client. Also known as registrar
- discover(name)[source]
Sends a query for the specified service name.
- Parameters:
name – the service name (or one of its aliases)
- Returns:
a list of
(host, port)
tuples
- list(filter_host=None)[source]
Send a query for the full lists of exposed servers :returns: a list of `` service_name ``
- class rpyc.utils.registry.UDPRegistryClient(ip='255.255.255.255', port=18811, timeout=2, bcast=None, logger=None, ipv6=False)[source]
UDP-based registry clients. By default, it sends UDP broadcasts (requires special user privileges on certain OS’s) and collects the replies. You can also specify the IP address to send to.
Example:
registrar = UDPRegistryClient() list_of_services = registrar.list() list_of_servers = registrar.discover("foo")
Note
Consider using
rpyc.utils.factory.discover()
instead- discover(name)[source]
Sends a query for the specified service name.
- Parameters:
name – the service name (or one of its aliases)
- Returns:
a list of
(host, port)
tuples
- list(filter_host=None)[source]
Send a query for the full lists of exposed servers :returns: a list of `` service_name ``
- class rpyc.utils.registry.TCPRegistryClient(ip, port=18811, timeout=2, logger=None)[source]
TCP-based registry client. You must specify the host (registry server) to connect to.
Example:
registrar = TCPRegistryClient("localhost") list_of_services = registrar.list() list_of_servers = registrar.discover("foo")
Note
Consider using
rpyc.utils.factory.discover()
instead- discover(name)[source]
Sends a query for the specified service name.
- Parameters:
name – the service name (or one of its aliases)
- Returns:
a list of
(host, port)
tuples
- list(filter_host=None)[source]
Send a query for the full lists of exposed servers :returns: a list of `` service_name ``