1net_adm(3) Erlang Module Definition net_adm(3)
2
3
4
6 net_adm - Various Erlang net administration routines.
7
9 This module contains various network utility functions.
10
12 dns_hostname(Host) -> {ok, Name} | {error, Host}
13
14 Types:
15
16 Host = atom() | string()
17 Name = string()
18
19 Returns the official name of Host, or {error, Host} if no such
20 name is found. See also inet(3).
21
22 host_file() -> Hosts | {error, Reason}
23
24 Types:
25
26 Hosts = [Host :: atom()]
27 Reason =
28 file:posix() |
29 badarg | terminated | system_limit |
30 {Line :: integer(), Mod :: module(), Term :: term()}
31
32 Reads file .hosts.erlang, see section Files. Returns the hosts
33 in this file as a list. Returns {error, Reason} if the file can‐
34 not be read or the Erlang terms on the file cannot be inter‐
35 preted.
36
37 localhost() -> Name
38
39 Types:
40
41 Name = string()
42
43 Returns the name of the local host. If Erlang was started with
44 command-line flag -name, Name is the fully qualified name.
45
46 names() -> {ok, [{Name, Port}]} | {error, Reason}
47
48 names(Host) -> {ok, [{Name, Port}]} | {error, Reason}
49
50 Types:
51
52 Host = atom() | string() | inet:ip_address()
53 Name = string()
54 Port = integer() >= 0
55 Reason = address | file:posix()
56
57 Similar to epmd -names, see erts:epmd(1). Host defaults to the
58 local host. Returns the names and associated port numbers of the
59 Erlang nodes that epmd registered at the specified host. Returns
60 {error, address} if epmd is not operational.
61
62 Example:
63
64 (arne@dunn)1> net_adm:names().
65 {ok,[{"arne",40262}]}
66
67 ping(Node) -> pong | pang
68
69 Types:
70
71 Node = atom()
72
73 Sets up a connection to Node. Returns pong if it is successful,
74 otherwise pang.
75
76 world() -> [node()]
77
78 world(Arg) -> [node()]
79
80 Types:
81
82 Arg = verbosity()
83 verbosity() = silent | verbose
84
85 Calls names(Host) for all hosts that are specified in the Erlang
86 host file .hosts.erlang, collects the replies, and then evalu‐
87 ates ping(Node) on all those nodes. Returns the list of all
88 nodes that are successfully pinged.
89
90 Arg defaults to silent. If Arg == verbose, the function writes
91 information about which nodes it is pinging to stdout.
92
93 This function can be useful when a node is started, and the
94 names of the other network nodes are not initially known.
95
96 Returns {error, Reason} if host_file() returns {error, Reason}.
97
98 world_list(Hosts) -> [node()]
99
100 world_list(Hosts, Arg) -> [node()]
101
102 Types:
103
104 Hosts = [atom()]
105 Arg = verbosity()
106 verbosity() = silent | verbose
107
108 Same as world/0,1, but the hosts are specified as argument in‐
109 stead of being read from .hosts.erlang.
110
112 File .hosts.erlang consists of a number of host names written as Erlang
113 terms. It is looked for in the current work directory, the user's home
114 directory, and $OTP_ROOT (the root directory of Erlang/OTP), in that
115 order.
116
117 The format of file .hosts.erlang must be one host name per line. The
118 host names must be within quotes.
119
120 Example:
121
122 ^ (new line)
123
124
125
126Ericsson AB kernel 8.3.2 net_adm(3)