13.8 Distribution BIFs

Some useful BIFs for distributed programming (for more information, see the erlang(3) manual page in ERTS:

BIFDescription
erlang:disconnect_node(Node)Forces the disconnection of a node.
erlang:get_cookie()Returns the magic cookie of the current node.
is_alive()Returns true if the runtime system is a node and can connect to other nodes, false otherwise.
monitor_node(Node, true|false)Monitors the status of Node. A message{nodedown, Node} is received if the connection to it is lost.
node()Returns the name of the current node. Allowed in guards.
node(Arg)Returns the node where Arg, a pid, reference, or port, is located.
nodes()Returns a list of all visible nodes this node is connected to.
nodes(Arg)Depending on Arg, this function can return a list not only of visible nodes, but also hidden nodes and previously known nodes, and so on.
erlang:set_cookie(Node, Cookie)Sets the magic cookie used when connecting to Node. If Node is the current node, Cookie is used when connecting to all new nodes.
spawn_link|_optCreates a process at a remote node.
spawn_link|optCreates a process at a remote node.

Table 13.1: Distribution BIFs