19962016 Ericsson AB. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. net_adm Claes Wikstrom 1 1996-09-10 A
net_adm Various Erlang net administration routines.

This module contains various network utility functions.

Official name of a host.

Returns the official name of Host, or {error, Host} if no such name is found. See also inet(3).

Read file .hosts.erlang.

Reads file .hosts.erlang, see section Files. Returns the hosts in this file as a list. Returns {error, Reason} if the file cannot be read or the Erlang terms on the file cannot be interpreted.

Name of the local host.

Returns the name of the local host. If Erlang was started with command-line flag -name, Name is the fully qualified name.

Names of Erlang nodes at a host.

Similar to epmd -names, see erts:epmd(1). Host defaults to the local host. 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> net_adm:names().
{ok,[{"arne",40262}]}
Set up a connection to a node.

Sets up a connection to Node. Returns pong if it is successful, otherwise pang.

Lookup and connect to all nodes at all hosts in .hosts.erlang.

Calls names(Host) for all hosts that are specified in the Erlang host file .hosts.erlang, collects the replies, and then evaluates ping(Node) on all those nodes. Returns the list of all nodes that are successfully pinged.

Arg defaults to silent. If Arg == verbose, the function writes information about which nodes it is pinging to stdout.

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

Returns {error, Reason} if host_file() returns {error, Reason}.

Lookup and connect to all nodes at specified hosts.

Same as world/0,1, but the hosts are specified as argument instead of being read from .hosts.erlang.

Files

File .hosts.erlang 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 $OTP_ROOT (the root directory of Erlang/OTP), in that order.

The format of file .hosts.erlang must be one host name per line. The host names must be within quotes.

Example:

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