epmd.epmd_server

The EPMD server and its table of registered nodes.

class epmd.epmd_server.Epmd(host=None, port=4369, *, addresses=None, packet_timeout=60.0, relaxed_command_check=False, max_connections=1024)

Bases: object

Listens on the EPMD protocol port and handles discovery of running Erlang nodes on this host.

EPMD_DEFAULT_PORT = 4369
DEFAULT_PACKET_TIMEOUT = 60.0
DEFAULT_MAX_CONNECTIONS = 1024
addresses: list[str]
nodes: dict[bytes, EpmdNode]
async start()

Start listening and return once the socket listens.

Afterwards self.port is the bound port (useful with port=0; every address then gets the port the first one got).

Raises:
  • OSError – the port is in use, typically by another EPMD, or a required address cannot be bound.

  • EpmdError – an entry of addresses is not an IP address, or there are more than 13.

async stop()

Stop listening and close every client connection. Registered nodes are forgotten. Calling it again, or before start, is safe.

async start_server()

Start listening and serve until cancelled or stopped (stop() or a KILL_REQ); then stop.

Raises:

OSError – the port is in use, typically by another EPMD.

register(node_name, data)

Attempts to register a node. Returns True if successful, False if the node is already registered.

Sets data.cr_counter: one more than at the name’s previous registration if it is remembered, else a random start.

unregister(node_name)

Called from EpmdProtocol when a client disconnects or when a STOP command arrives (documentation claims this is not used but still implemented). Removes the node from the list of nodes.