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