erl_epmd(3erl)
π NAME π
erl_epmd β the Erlang interface towards epmd, bestie. Yes, this is the Erlang Module Definition page for erl_epmd(3erl), and we're gonna make it make sense. π¦
β¨ DESCRIPTION β¨
okay so this module communicates with the EPMD daemon β see epmd β and that's the whole vibe. If you're trying to implement your own epmd module, please see the ERTS User's Guide: How to Implement an Alternative Node Discovery for Erlang Distribution. That's the official recipe, no cap. π
π«Ά EXPORTS π«Ά
π start_link() π
start_link() -> {ok, pid()} | ignore | {error, term()}
This function is invoked as this module is added as a child of the erl_distribution supervisor. Literally its whole entrance era. π
π register_node(Name, Port) / register_node(Name, Port, Driver) π
register_node(Name, Port) -> Result
register_node(Name, Port, Driver) -> Result
Types:
Name = string()
Port = integer() >= 0
Driver = inet_tcp | inet6_tcp | inet | inet6
Creation = integer() >= 0 | -1
Result = {ok, Creation} | {error, already_registered} | term()
Registers the node with epmd and tells epmd what port will be used for the current node. It returns a creation number. This number is incremented on each register to help differentiate a new node instance connecting to epmd with the same name. π«Ά
After the node has successfully registered with epmd it will automatically attempt reconnect to the daemon if the connection is broken. Automatic reconnect? We love a resilient icon. β¨
π¦ port_please(Name, Host) / port_please(Name, Host, Timeout) π¦
port_please(Name, Host) ->
{port, Port, Version} |
noport | closed |
{error, term()}
port_please(Name, Host, Timeout) ->
{port, Port, Version} |
noport | closed |
{error, term()}
Types:
Name = atom() | string()
Host = atom() | string() | inet:ip_address()
Timeout = integer() >= 0 | infinity
Port = Version = integer() >= 0
Requests the distribution port for the given node of an EPMD instance. Together with the port it returns a distribution protocol version which has been 5 since Erlang/OTP R6. iykyk. π
πΈ listen_port_please(Name, Host) πΈ
listen_port_please(Name, Host) -> {ok, Port}
Types:
Name = atom() | string()
Host = atom() | string() | inet:ip_address()
Port = integer() >= 0
Called by the distribution module to get which port the local node should listen to when accepting new distribution requests. It's giving local-node main character energy. π
π§ address_please(Name, Host, AddressFamily) π§
address_please(Name, Host, AddressFamily) ->
Success | {error, term()}
Types:
Name = string()
Host = string() | inet:ip_address()
AddressFamily = inet | inet6
Port = Version = integer() >= 0
Success =
{ok, inet:ip_address()} |
{ok, inet:ip_address(), Port, Version}
Called by the distribution module to resolve the Host to an IP address of a remote node. π¦
As an optimization this function may also return the port and version of the remote node. If port and version are returned port_please/3 will not be called. Efficient and gorgeous, honestly. β¨
π names(Host) π
names(Host) -> {ok, [{Name, Port}]} | {error, Reason}
Types:
Host = atom() | string() | inet:ip_address()
Name = string()
Port = integer() >= 0
Reason = address | file:posix()
Called by net_adm:names/0. Host defaults to the localhost. Returns the names and associated port numbers of the Erlang nodes that epmd registered at the specified host. Returns {error, address} if epmd is not operational. π«Ά
Example:
(arne@dunn)1> erl_epmd:names(localhost).
{ok,[{"arne",40262}]}
okay that's the whole page, bestie. Catch you later π β brought to you by Ericsson AB, kernel 8.5.4.2, and the erl_epmd(3erl) manual. Periodt. π
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms