nanover.essd.server module
Module providing a server for Extremely Simple Service Discovery (ESSD).
NanoVer servers can use this class to broadcast themselves on a local area network, using UDP.
Example
>>> discovery_server = DiscoveryServer(broadcast_port=54545)
>>> # assume one has created a multiplayer server.
>>> hub = ServiceHub(name="Example NanoVer Service Hub", address="[::]")
>>> hub.add_service("multiplayer", 54323)
>>> discovery_server.close()
- class nanover.essd.server.DiscoveryServer(broadcast_port: int | None = None, delay=0.5)
Bases:
object
- close()
- get_broadcast_addresses_for_service(service) List[Dict[str, str]]
- property is_broadcasting
- log_addresses(level=10)
- register_service(service: ServiceHub)
Register a service for discovery.
- Parameters:
service – Service to register.
- services: Dict[ServiceHub, List[Dict[str, str]]]
- start()
- unregister_service(service: ServiceHub)
Removes a service from discovery.
- Parameters:
service – The service to remove.
- Raises:
KeyError – Raised if the service has never been registered with this discovery server.
- nanover.essd.server.configure_reusable_socket() socket
Sets up a socket set up for broadcasting with reuseable address.
- Returns:
A socket.