.TH net_adm 3erl "kernel 5.1.1" "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 \fB\fIinet(3erl)\fR\&\fR\&\&. .RE .LP .nf .B host_file() -> Hosts | {error, Reason} .br .fi .br .RS .LP Types: .RS 3 Hosts = [Host :: atom()] .br Reason = .br \fBfile:posix()\fR\& | .br badarg | .br terminated | .br system_limit | .br {Line :: integer(), Mod :: module(), Term :: term()} .br .RE .RE .RS .LP Reads file \fI\&.hosts\&.erlang\fR\&, see section \fBFiles\fR\&\&. Returns the hosts in this file as a list\&. Returns \fI{error, Reason}\fR\& if the file cannot be read or the Erlang terms on the file cannot 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 command-line flag \fI-name\fR\&, \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 \fB\fIerts:epmd(1)\fR\&\fR\&\&. \fIHost\fR\& defaults to the local host\&. Returns the names and associated port numbers of the Erlang nodes that \fIepmd\fR\& registered at the specified host\&. Returns \fI{error, address}\fR\& if \fIepmd\fR\& is not operational\&. .LP \fIExample:\fR\& .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 Sets up a connection to \fINode\fR\&\&. Returns \fIpong\fR\& if it is successful, otherwise \fIpang\fR\&\&. .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 Calls \fInames(Host)\fR\& for all hosts that 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 are successfully pinged\&. .LP \fIArg\fR\& defaults to \fIsilent\fR\&\&. If \fIArg == verbose\fR\&, the function writes information about which nodes it is pinging to \fIstdout\fR\&\&. .LP This function can be useful when a node is started, and the names of the other network nodes are not initially known\&. .LP Returns \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 Same as \fB\fIworld/0,1\fR\&\fR\&, but the hosts are specified as argument instead of being read from \fI\&.hosts\&.erlang\fR\&\&. .RE .SH "FILES" .LP File \fI\&.hosts\&.erlang\fR\& 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 file \fI\&.hosts\&.erlang\fR\& must be one host name per line\&. The host names must be within quotes\&. .LP \fIExample:\fR\& .LP .nf \&'super.eua.ericsson.se'. \&'renat.eua.ericsson.se'. \&'grouse.eua.ericsson.se'. \&'gauffin1.eua.ericsson.se'. ^ (new line) .fi