net_adm(3)

MODULE
net_adm - Various Erlang Net Administration Routines

DESCRIPTION

This module contains various network utility functions.

EXPORTS

host_file()

    This function reads the .hosts.erlang file. It returns the hosts in this file as a list, or it returns {error, Reason} if the file cannot be found.

dns_hostname(Host)

    This function calls epmd for the fully qualified name (DNS) of Host. It returns {ok, Longhostname} if the call is successful, or {error, Host} if Host cannot be located by DNS.

localhost()

    This function returns the fully qualified name of the local host, if it can be found by DNS.

names(), names(Host)

    This function returns {ok, List} or {error, Reason}. List is a list of tuples on the form {Name, Port}. For example: net_adm:names(elrond) -> {ok, [{"foo", 61178}, {"ts", 61160}]}.

ping(Node)

    This function tries to set up a connection to Node. It returns pang if it fails, and pong if it is successful.

world (), world (verbose)

    This function runs epmd - names on all hosts which are specified in the Erlang host file .hosts.erlang, collects the replies and then evaluates ping on all those nodes. Accordingly, connections are created to all nodes which are running on the hosts specified in the .hosts.erlang file. An error message is printed if another user node is found when this is done.

    This function can be useful when a node is started, but the names of the other nodes in the network are not initially known.

world_list (Hostlist), world_list (Hostlist, verbose)

    These functions are the same as world/0 and world/1, but instead of reading the hostfile from .hosts.erlang the hosts are specified in Hostlist.

Files

The .hosts.erlang file consists of a number of host names written as Erlang terms. It can be located in the current work directory, $HOME/.hosts.erlang, or code:root_dir()/.hosts.erlang. The format of the .hosts.erlang file must be one host name per line. The host names must be within quotes as shown in the following examples:

      'super.eua.ericsson.se'.
      'renat.eua.ericsson.se'.
      'grouse.eua.ericsson.se'.
      'gauffin1.eua.ericsson.se'.
      ^ (new line)

AUTHOR
 Claes Wikstrom - support@erlang.ericsson.se