.TH net_adm 3erl "kernel 3.0.3" "Ericsson AB" "Erlang Module Definition" .SH NAME net_adm \- Various Erlang Net Administration Routines .SH DESCRIPTION .LP This module contains various network utility functions\&. .SH EXPORTS .LP .nf .B dns_hostname(Host) -> {ok, Name} | {error, Host} .br .fi .br .RS .LP Types: .RS 3 Host = atom() | string() .br Name = string() .br .RE .RE .RS .LP Returns the official name of \fIHost\fR\&, or \fI{error, Host}\fR\& if no such name is found\&. See also \fIinet(3erl)\fR\&\&. .RE .LP .nf .B host_file() -> Hosts | {error, Reason} .br .fi .br .RS .LP Types: .RS 3 Hosts = [Host :: atom()] .br Reason = \fBfile:posix()\fR\& .br | badarg .br | terminated .br | system_limit .br | {Line :: integer(), Mod :: module(), Term :: term()} .br .RE .RE .RS .LP Reads the \fI\&.hosts\&.erlang\fR\& file, see the section \fIFiles\fR\& below\&. Returns the hosts in this file as a list, or returns \fI{error, Reason}\fR\& if the file could not be read or the Erlang terms on the file could not be interpreted\&. .RE .LP .nf .B localhost() -> Name .br .fi .br .RS .LP Types: .RS 3 Name = string() .br .RE .RE .RS .LP Returns the name of the local host\&. If Erlang was started with the \fI-name\fR\& command line flag, \fIName\fR\& is the fully qualified name\&. .RE .LP .nf .B names() -> {ok, [{Name, Port}]} | {error, Reason} .br .fi .br .nf .B names(Host) -> {ok, [{Name, Port}]} | {error, Reason} .br .fi .br .RS .LP Types: .RS 3 Host = atom() | string() | \fBinet:ip_address()\fR\& .br Name = string() .br Port = integer() >= 0 .br Reason = address | \fBfile:posix()\fR\& .br .RE .RE .RS .LP Similar to \fIepmd -names\fR\&, see \fIepmd(1)\fR\&\&. \fIHost\fR\& defaults to the local host\&. Returns the names and associated port numbers of the Erlang nodes that \fIepmd\fR\& at the specified host has registered\&. .LP Returns \fI{error, address}\fR\& if \fIepmd\fR\& is not running\&. .LP .nf (arne@dunn)1> net_adm:names()\&. {ok,[{"arne",40262}]} .fi .RE .LP .nf .B ping(Node) -> pong | pang .br .fi .br .RS .LP Types: .RS 3 Node = atom() .br .RE .RE .RS .LP Tries to set up a connection to \fINode\fR\&\&. Returns \fIpang\fR\& if it fails, or \fIpong\fR\& if it is successful\&. .RE .LP .nf .B world() -> [node()] .br .fi .br .nf .B world(Arg) -> [node()] .br .fi .br .RS .LP Types: .RS 3 Arg = \fBverbosity()\fR\& .br .nf \fBverbosity()\fR\& = silent | verbose .fi .br .RE .RE .RS .LP This function calls \fInames(Host)\fR\& for all hosts which are specified in the Erlang host file \fI\&.hosts\&.erlang\fR\&, collects the replies and then evaluates \fIping(Node)\fR\& on all those nodes\&. Returns the list of all nodes that were, successfully pinged\&. .LP \fIArg\fR\& defaults to \fIsilent\fR\&\&. If \fIArg == verbose\fR\&, the function writes information about which nodes it is pinging to stdout\&. .LP This function can be useful when a node is started, and the names of the other nodes in the network are not initially known\&. .LP Failure: \fI{error, Reason}\fR\& if \fIhost_file()\fR\& returns \fI{error, Reason}\fR\&\&. .RE .LP .nf .B world_list(Hosts) -> [node()] .br .fi .br .nf .B world_list(Hosts, Arg) -> [node()] .br .fi .br .RS .LP Types: .RS 3 Hosts = [atom()] .br Arg = \fBverbosity()\fR\& .br .nf \fBverbosity()\fR\& = silent | verbose .fi .br .RE .RE .RS .LP As \fIworld/0,1\fR\&, but the hosts are given as argument instead of being read from \fI\&.hosts\&.erlang\fR\&\&. .RE .SH "FILES" .LP The \fI\&.hosts\&.erlang\fR\& file consists of a number of host names written as Erlang terms\&. It is looked for in the current work directory, the user\&'s home directory, and \fI$OTP_ROOT\fR\& (the root directory of Erlang/OTP), in that order\&. .LP The format of the \fI\&.hosts\&.erlang\fR\& file must be one host name per line\&. The host names must be within quotes as shown in the following example: .LP .nf \&'super.eua.ericsson.se'. \&'renat.eua.ericsson.se'. \&'grouse.eua.ericsson.se'. \&'gauffin1.eua.ericsson.se'. ^ (new line) .fi