pyrlang.dist_proto.epmd_client¶
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.
Message layouts are in “EPMD Protocol” of erl_dist_protocol; the names
are those of OTP 29.
- class pyrlang.dist_proto.epmd_client.EPMDClient(port=None)¶
Bases:
ProtocolAn EPMD client connection which registers ourselves in EPMD and can do other queries.
- host_¶
The local EPMD is always located on the local host.
- port_¶
The local EPMD’s port.
- close()¶
Closing EPMD connection removes the node from available EPMD nodes list. Safe before
connectand when called again.
- async connect()¶
Establish the long running connection to the local EPMD.
- Returns:
True
- Raises:
EPMDConnectionError – EPMD cannot be reached within
EPMD_TIMEOUTseconds- Return type:
- async alive2(dist)¶
Register the node in EPMD (
EPMD_ALIVE2_REQ): a hidden node as type 72, a visible one as 77.- Parameters:
dist (distribution.ErlangDistribution) – The distribution object from the node
- Returns:
True
- Raises:
EPMDConnectionError – EPMD refused the name (it is in use), closed the connection or did not answer in time
- Return type:
- async static query_node(node_name, port=None)¶
Query EPMD about the port to the given node.
- Parameters:
node_name (str) – String with node “name@ip” or “name@hostname”
port (int | None) – EPMD port on that host; default from
epmd_port()
- Returns:
Host (the address EPMD answered on) and port (where the node is), or None if not found
- Throws EPMDClientError:
if something is wrong with input
- Throws EPMDConnectionError:
if EPMD on that host cannot be reached or answers nonsense, or the node does not speak distribution protocol version 6 (OTP 23 and newer)
- Return type:
- pyrlang.dist_proto.epmd_client.epmd_port()¶
The EPMD port:
ERL_EPMD_PORTif set (as forerl), else 4369.