1net(3) Erlang Module Definition net(3)
2
3
4
6 net - Network interface.
7
9 This module provides an API for the network interface.
10
11 Note:
12 There is currently no support for Windows.
13
14
16 address_info() =
17 #{family := socket:domain(),
18 socktype := socket:type(),
19 protocol := socket:protocol(),
20 address := socket:sockaddr()}
21
22 name_info() = #{host := string(), service := string()}
23
24 name_info_flags() = [name_info_flag() | name_info_flag_ext()]
25
26 name_info_flag() =
27 namereqd | dgram | nofqdn | numerichost | nomericserv
28
29 name_info_flag_ext() =
30 idn | idna_allow_unassigned | idna_use_std3_ascii_rules
31
32 network_interface_name() = string()
33
34 network_interface_index() = integer() >= 0
35
37 gethostname() -> {ok, HostName} | {error, Reason}
38
39 Types:
40
41 HostName = string()
42 Reason = term()
43
44 Returns the name of the current host.
45
46 getnameinfo(SockAddr) -> {ok, Info} | {error, Reason}
47
48 getnameinfo(SockAddr, Flags) -> {ok, Info} | {error, Reason}
49
50 Types:
51
52 SockAddr = socket:sockaddr()
53 Flags = name_info_flags() | undefined
54 Info = name_info()
55 Reason = term()
56
57 Address-to-name translation in a protocol-independant manner.
58
59 This function is the inverse of getaddrinfo. It converts a
60 socket address to a corresponding host and service.
61
62 getaddrinfo(Host) -> {ok, Info} | {error, Reason}
63
64 getaddrinfo(Host, Service :: undefined) ->
65 {ok, Info} | {error, Reason}
66
67 getaddrinfo(Host :: undefined, Service) ->
68 {ok, Info} | {error, Reason}
69
70 getaddrinfo(Host, Service) -> {ok, Info} | {error, Reason}
71
72 Types:
73
74 Host = Service = string()
75 Info = [address_info()]
76 Reason = term()
77
78 Network address and service translation.
79
80 This function is the inverse of getnameinfo. It converts host
81 and service to a corresponding socket address.
82
83 One of the Host and Service may be undefined but not both.
84
85 if_name2index(Name) -> {ok, Idx} | {error, Reason}
86
87 Types:
88
89 Name = network_interface_name()
90 Idx = network_interface_index()
91 Reason = term()
92
93 Mappings between network interface names and indexes.
94
95 if_index2name(Idx) -> {ok, Name} | {error, Reason}
96
97 Types:
98
99 Idx = network_interface_index()
100 Name = network_interface_name()
101 Reason = term()
102
103 Mappings between network interface index and names.
104
105 if_names() -> Names | {error, Reason}
106
107 Types:
108
109 Names = [{Idx, If}]
110 Idx = network_interface_index()
111 If = network_interface_name()
112 Reason = term()
113
114 Get network interface names and indexes.
115
116
117
118Ericsson AB kernel 6.5 net(3)