dist_proto.epmd_client module

The module represents EPMD connection and implements the protocol. EPMD is a daemon application, part of Erlang/OTP which registers Erlang nodes on the local machine and helps nodes finding each other.

class pyrlang.dist_proto.epmd_client.EPMDClient

Bases: asyncio.protocols.Protocol

An EPMD client connection which registers ourselves in EPMD and can do other queries.

async alive2(dist) → bool

Send initial hello (ALIVE2) to EPMD

Parameters

dist (pyrlang.dist.distribution.ErlangDistribution) -- The distribution object from the node

Return type

bool

close()

Closing EPMD connection removes the node from available EPMD nodes list.

async connect() → bool

Establish a long running connection to EPMD, will not return until the connection has been established.

Return type

True if connection succeeded within 5 tries, else False

host_ = None

The local EPMD is always located on the local host.

port_ = None

We expect local EPMD to be available on the default port.

static query_node(node_name: str) → [typing.Tuple[str, int], None]

Query EPMD about the port to the given node.

Parameters

node_name -- String with node "name@ip" or "name@hostname"

Returns

Host and port where the node is, or None if not found

Return type

[tuple(str, int), None]

Throws EPMDClientError

if something is wrong with input

Throws EPMDConnectionError

if connection went wrong