inet(3erl)
πΈ NAME πΈ
inet β Access to TCP/IP protocols. This is the inet(3erl) Erlang module definition page, bestie π
β¨ DESCRIPTION β¨
Okay so this module gives you access to TCP/IP protocols. That's the whole vibe: sockets, addresses, protocols, the good stuff.
Also see ERTS User's Guide: Inet Configuration for more info about how to configure an Erlang runtime system for IP communication. iykyk π«Ά
These two Kernel configuration parameters affect the behavior of all sockets opened on an Erlang node:
inet_default_connect_optionscan contain a list of default options used for all sockets returned when doingconnect.inet_default_listen_optionscan contain a list of default options used when issuing alistencall.
When accept is issued, the values of the listening socket options are inherited. No such application variable is therefore needed for accept. Periodt. β¨
Using the Kernel configuration parameters above, one can set default options for all TCP sockets on a node, but use this with care, bestie. Options such as {delay_send,true} can be specified in this way. The following is an example of starting an Erlang node with all sockets using delayed send:
$ erl -sname test -kernel \
inet_default_connect_options '[{delay_send,true}]' \
inet_default_listen_options '[{delay_send,true}]'
Notice that default option {active, true} cannot be changed, for internal reasons. That one is not up for debate. π
Addresses as inputs to functions can be either a string or a tuple. For example, the IP address 150.236.20.73 can be passed to gethostbyaddr/1, either as string "150.236.20.73" or as tuple {150, 236, 20, 73}. Iconic flexibility, honestly.
IPv4 address examples:
Address ip_address()
------- ------------
127.0.0.1 {127,0,0,1}
192.168.42.2 {192,168,42,2}
IPv6 address examples:
Address ip_address()
------- ------------
::1 {0,0,0,0,0,0,0,1}
::192.168.42.2 {0,0,0,0,0,0,(192 bsl 8) bor 168,(42 bsl 8) bor 2}
::FFFF:192.168.42.2
{0,0,0,0,0,16#FFFF,(192 bsl 8) bor 168,(42 bsl 8) bor 2}
3ffe:b80:1f8d:2:204:acff:fe17:bf38
{16#3ffe,16#b80,16#1f8d,16#2,16#204,16#acff,16#fe17,16#bf38}
fe80::204:acff:fe17:bf38
{16#fe80,0,0,0,16#204,16#acff,16#fe17,16#bf38}
Function parse_address/1 can be useful:
1> inet:parse_address("192.168.42.2").
{ok,{192,168,42,2}}
2> inet:parse_address("::FFFF:192.168.42.2").
{ok,{0,0,0,0,0,65535,49320,10754}}
π DATA TYPES π
π§ Exported data types π§
hostent() =
hostent() =
#hostent{h_name = inet:hostname(),
h_aliases = [inet:hostname()],
h_addrtype = inet | inet6,
h_length = integer() >= 0,
h_addr_list = [inet:ip_address()]}
The record is defined in the Kernel include file "inet.hrl". Add the following directive to the module:
-include_lib("kernel/include/inet.hrl").
hostname() = atom() | string()
ip_address() = ip4_address() | ip6_address()
ip4_address() = {0..255, 0..255, 0..255, 0..255}
ip6_address() =
ip6_address() =
{0..65535,
0..65535,
0..65535,
0..65535,
0..65535,
0..65535,
0..65535,
0..65535}
port_number() = 0..65535
family_address() = inet_address() | inet6_address() | local_address()
A general address format on the form {Family, Destination} where Family is an atom such as local and the format of Destination depends on Family, and is a complete address (for example an IP address including port number). It's giving "one shape, many families." π¦
local_address() = {local, File :: binary() | string()}
This address family only works on Unix-like systems. Unix girlies, this one's for you.
File is normally a file pathname in a local filesystem. It is limited in length by the operating system, traditionally to 108 bytes.
A binary() is passed as is to the operating system, but a string() is encoded according to the system filename encoding mode.
Other addresses are possible, for example Linux implements "Abstract Addresses". See the documentation for Unix Domain Sockets on your system, normally unix in manual section 7.
In most API functions where you can use this address family the port number must be 0.
inet_backend() = {inet_backend, inet | socket}
Select the implementation backend for sockets. The current default is inet which at the bottom uses inet_drv.c to call the platform's socket API. The value socket instead at the bottom uses the socket module and its NIF implementation.
This is a temporary option that will be ignored in a future release. So don't get too attached, bestie. π
socket_address() = ip_address() | any | loopback | local_address()
socket_getopt() =
socket_getopt() =
gen_sctp:option_name() |
gen_tcp:option_name() |
gen_udp:option_name()
socket_setopt() =
socket_setopt() =
gen_sctp:option() | gen_tcp:option() | gen_udp:option()
socket_optval() =
socket_optval() =
gen_sctp:option_value() |
gen_tcp:option() |
gen_udp:option() |
gen_tcp:pktoptions_value()
returned_non_ip_address() = {local, binary()} | {unspec, <<>>} | {undefined, any()}
Addresses besides ip_address() ones that are returned from socket API functions. See in particular local_address(). The unspec family corresponds to AF_UNSPEC and can occur if the other side has no socket address. The undefined family can only occur in the unlikely event of an address family that the VM does not recognize. Rare little creature, that one. π
ancillary_data() = [{tos, byte()} | {tclass, byte()} | {ttl, byte()}]
Ancillary data received with the data packet, read with the socket option pktoptions from a TCP socket, or to set in a call to gen_udp:send/4 or gen_udp:send/5.
The value(s) correspond to the currently active socket options recvtos, recvtclass and recvttl, or for a single send operation the option(s) to override the currently active socket option(s). Main character energy for your packet metadata. π
posix() =
posix() =
eaddrinuse | eaddrnotavail | eafnosupport | ealready |
econnaborted | econnrefused | econnreset | edestaddrreq |
ehostdown | ehostunreach | einprogress | eisconn | emsgsize |
enetdown | enetunreach | enopkg | enoprotoopt | enotconn |
enotty | enotsock | eproto | eprotonosupport | eprototype |
esocktnosupport | etimedout | ewouldblock | exbadport |
exbadseq |
file:posix()
An atom that is named from the POSIX error codes used in Unix, and in the runtime libraries of most C compilers. See section POSIX Error Codes. Yes, the error atoms ate. π
socket()
See gen_tcp:type-socket and gen_udp:type-socket.
address_family() = inet | inet6 | local
socket_protocol() = tcp | udp | sctp
stat_option() =
stat_option() =
recv_cnt | recv_max | recv_avg | recv_oct | recv_dvi |
send_cnt | send_max | send_avg | send_oct | send_pend
π DATA TYPES π (the sequel)
π§ Internal data types π§
inet_address() = {inet, {ip4_address() | any | loopback, port_number()}}
Warning: This address format is for now experimental and for completeness to make all address families have a {Family, Destination} representation.
inet6_address() = {inet6, {ip6_address() | any | loopback, port_number()}}
Warning: This address format is for now experimental and for completeness to make all address families have a {Family, Destination} representation.
getifaddrs_ifopts() =
getifaddrs_ifopts() =
[Ifopt ::
{flags,
Flags ::
[up | broadcast | loopback | pointtopoint |
running | multicast]} |
{addr, Addr :: ip_address()} |
{netmask, Netmask :: ip_address()} |
{broadaddr, Broadaddr :: ip_address()} |
{dstaddr, Dstaddr :: ip_address()} |
{hwaddr, Hwaddr :: [byte()]}]
Interface address description list returned from getifaddrs/0,1 for a named interface, translated from the returned data of the POSIX API function getaddrinfo().
Hwaddr is hardware dependent, for example, on Ethernet interfaces it is the 6-byte Ethernet address (MAC address (EUI-48 address)). Hardware girlies rise. π§
The tuples {addr,Addr}, {netmask,Netmask}, and possibly {broadaddr,Broadaddr} or {dstaddr,Dstaddr} are repeated in the list if the interface has got multiple addresses. An interface may have multiple {flag,_} tuples for example if it has different flags for different address families. Multiple {hwaddr,Hwaddr} tuples is hard to say anything definite about, though. The tuple {flag,Flags} is mandatory, all others are optional. Mandatory flag tuple has main character energy. β¨
Do not rely too much on the order of Flags atoms or the Ifopt tuples. There are however some rules:
- A
{flag,_}tuple applies to all other tuples that follow. - Immediately after
{addr,_}follows{netmask,_}. - Immediately thereafter may
{broadaddr,_}follow ifbroadcastis member ofFlags, or{dstaddr,_}ifpointtopointis member ofFlags. Both{dstaddr,_}and{broadaddr,_}does not occur for the same{addr,_}. - Any
{netmask,_},{broadaddr,_}, or{dstaddr,_}tuples that follow an{addr,Addr}tuple concerns the addressAddr.
The tuple {hwaddr,_} is not returned on Solaris, as the hardware address historically belongs to the link layer and it is not returned by the Solaris API function getaddrinfo(). Solaris said "not today, hardware address." π
Warning: On Windows, the data is fetched from different OS API functions, so theNetmaskandBroadaddrvalues may be calculated, just as someFlagsvalues.
π EXPORTS π
close(Socket) -> ok
Types:
Socket = socket()
Closes a socket of any type. Simple, clean, slay. π
cancel_monitor(MRef) -> boolean()
Types:
MRef = reference()
If MRef is a reference that the calling process obtained by calling monitor/1, this monitor is turned off. If the monitoring is already turned off, nothing happens.
The returned value is one of the following:
true: The monitor was found and removed. In this case, no'DOWN'message corresponding to this monitor has been delivered and will not be delivered.false: The monitor was not found and could not be removed. This probably because a'DOWN'message corresponding to this monitor has already been placed in the caller message queue.
Failure: It is an error if MRef refers to a monitor started by another process. Not your monitor, not your business, bestie. π«Ά
format_error(Reason) -> string()
Types:
Reason = posix() | system_limit
Returns a diagnostic error string π©Ί For possible POSIX values and corresponding strings, see section POSIX Error Codes.
πΎ get_rc() -> [{Par :: atom(), Val :: any()} | {Par :: atom(), Val1 :: any(), Val2 :: any()}]
get_rc() ->
[{Par :: atom(), Val :: any()} |
{Par :: atom(), Val1 :: any(), Val2 :: any()}]
Hands you back the state of the Inet configuration database, bestie β as a list of recorded configuration parameters β¨ Wanna know more? See ERTS User's Guide: Inet Configuration.
Real talk tho: only actual parameters with other than default values are returned. So like, not directives that specify other sources for configuration parameters, and not directives that clear parameters either. Only the ones that are actually doing something π
π getaddr(Host, Family) -> {ok, Address} | {error, posix()}
Types:
Host = ip_address() | hostname()
Family = address_family()
Address = ip_address()
Returns the IP address for Host as a tuple of integers π And Host can be literally whatever: an IP address, a single hostname, or a fully qualified hostname. Flexible queen.
π getaddrs(Host, Family) -> {ok, Addresses} | {error, posix()}
Types:
Host = ip_address() | hostname()
Family = address_family()
Addresses = [ip_address()]
Same energy as getaddr but it returns a list of all the IP addresses for Host π Again, Host can be an IP address, a single hostname, or a fully qualified hostname. She gives you options.
π gethostbyaddr(Address) -> {ok, Hostent} | {error, posix()}
Types:
Address = string() | ip_address()
Hostent = hostent()
Returns a hostent record for the host with the specified address π«Ά Reverse lookup slay.
π gethostbyname(Hostname) -> {ok, Hostent} | {error, posix()}
Types:
Hostname = hostname()
Hostent = hostent()
Returns a hostent record for the host with the specified hostname π
Heads up bestie: if the resolver optioninet6istrue, an IPv6 address is looked up π
ππ gethostbyname(Hostname, Family) -> {ok, Hostent} | {error, posix()}
Types:
Hostname = hostname()
Family = address_family()
Hostent = hostent()
Returns a hostent record for the host with the specified name, but restricted to the specified address family β¨ Same function, extra filter. Very main character of her.
π gethostname() -> {ok, Hostname}
Types:
Hostname = string()
Returns the local hostname πΈ And the best part? Never fails. Like, literally never π iconic behaviour, no notes.
π§ getifaddrs() -> {ok, [{Ifname :: string(), Ifopts :: getifaddrs_ifopts()}]} | {error, posix()}
getifaddrs() ->
{ok,
[{Ifname :: string(),
Ifopts :: getifaddrs_ifopts()}]} |
{error, posix()}
Returns a list of 2-tuples with interface names and the interfaces' addresses π¦ Ifname is a Unicode string and Ifopts is a list of interface address description tuples.
Those interface address description tuples? They're documented under the type of the Ifopts value, iykyk π
π§ββοΈ getifaddrs(Opts) -> {ok, [{Ifname, Ifopts}]} | {error, Posix}
Types:
Opts = [{netns, Namespace}]
Namespace = file:filename_all()
Ifname = string()
Ifopts = getifaddrs_ifopts()
Posix = posix()
Literally the same as getifaddrs/0, except the option {netns, Namespace} sets a network namespace for the OS call β but only on platforms that support that feature, so vibe check your platform first π
See the socket option {netns, Namespace} under setopts/2 π
βοΈ getopts(Socket, Options) -> {ok, OptionValues} | {error, posix()}
Types:
Socket = socket()
Options = [socket_getopt()]
OptionValues = [socket_optval()]
Gets one or more options for a socket, bestie π For a list of available inet options, see setopts/2. Also check the descriptions for the protocol specific types referenced by socket_optval() β¨
Now listen, this part matters: the number of elements in the returned OptionValues list does not necessarily correspond to the number of options you asked for π³ If the operating system fails to support an option, it's just left out of the returned list. An error tuple only comes back when getting options for the socket is literally impossible β that is, the socket is closed, or the buffer size in a raw request is too large π This behavior is kept for backward compatibility reasons.
A raw option request...
RawOptReq = {raw, Protocol, OptionNum, ValueSpec}
...can be used to get info about socket options that aren't (explicitly) supported by the emulator π Using raw socket options makes your code non-portable, but it lets the Erlang programmer take advantage of unusual features present on a particular platform. Trade-off queen.
RawOptReq consists of the tag raw, followed by the protocol level, the option number, and either a binary or the size, in bytes, of the buffer in which the option value is to be stored π«Ά A binary is to be used when the underlying getsockopt requires input in the argument field. In that case, the binary size is to correspond to the required buffer size of the return value. The values you supply in a RawOptReq correspond to the second, third, and fourth/fifth parameters to the getsockopt call in the C socket API. The value stored in the buffer comes back as a binary ValueBin, where all values are coded in the native endianness β¨
Fair warning: asking for and inspecting raw socket options requires low-level information about the current operating system and TCP stack π like, genuinely.
Example:
Consider a Linux machine where the option TCP_INFO can be used to collect TCP statistics for a socket π Assume you're interested in field tcpi_sacked of struct tcp_info filled in when asking for TCP_INFO. To be able to access this information, you need to know the following:
- The numeric value of protocol level
IPPROTO_TCP - The numeric value of option
TCP_INFO - The size of
struct tcp_info - The size and offset of the specific field
By inspecting the headers or writing a small C program, it's found that IPPROTO_TCP is 6, TCP_INFO is 11, the structure size is 92 (bytes), the offset of tcpi_sacked is 28 bytes, and the value is a 32-bit integer π§ The following code can be used to retrieve the value:
get_tcpi_sacked(Sock) ->
{ok,[{raw,_,_,Info}]} = inet:getopts(Sock,[{raw,6,11,92}]),
<<_:28/binary,TcpiSacked:32/native,_/binary>> = Info,
TcpiSacked.
Preferably, you would check the machine type, the operating system, and the Kernel version before executing anything similar to this code π (please do that, I'm begging π).
π getstat(Socket) -> {ok, OptionValues} | {error, posix()}
π getstat(Socket, Options) -> {ok, OptionValues} | {error, posix()}
Types:
Socket = socket()
Options = [stat_option()]
OptionValues = [{stat_option(), integer()}]
stat_option() =
recv_cnt | recv_max | recv_avg | recv_oct | recv_dvi |
send_cnt | send_max | send_avg | send_oct | send_pend
Gets one or more statistic options for a socket πβ¨
getstat(Socket) is equivalent to:
getstat(Socket, [recv_avg, recv_cnt, recv_dvi, recv_max, recv_oct,
send_avg, send_cnt, send_pend, send_max, send_oct])
The following options are available:
recv_avgβ Average size of packets, in bytes, received by the socket.recv_cntβ Number of packets received by the socket.recv_dviβ Average packet size deviation, in bytes, received by the socket.recv_maxβ Size of the largest packet, in bytes, received by the socket.recv_octβ Number of bytes received by the socket.send_avgβ Average size of packets, in bytes, sent from the socket.send_cntβ Number of packets sent from the socket.send_pendβ Number of bytes waiting to be sent by the socket.send_maxβ Size of the largest packet, in bytes, sent from the socket.send_octβ Number of bytes sent from the socket.
Numbers girlies rise π
π i() -> ok
π i(Proto :: socket_protocol()) -> ok
π i(X1 :: socket_protocol(), Fs :: [atom()]) -> ok
Lists all TCP, UDP and SCTP sockets β including the ones the Erlang runtime system uses and the ones your app created π¦ So you can see everything, no secrets, no cap.
The following options are available:
portβ The internal index of the port.moduleβ The callback module of the socket.recvβ Number of bytes received by the socket.sentβ Number of bytes sent from the socket.ownerβ The socket owner process.local_addressβ The local address of the socket.foreign_addressβ The address and port of the other end of the connection.stateβ The connection state.typeβSTREAMorDGRAMorSEQPACKET.
π«§ info(Socket) -> Info
Types:
Socket = socket()
Info = term()
Produces a term containing miscellaneous information about a socket β¨ She's giving mixed bag, she's giving ~everything~ π
ποΈ monitor(Socket) -> reference()
Types:
Socket = socket()
Starts monitoring the socket Socket ππ
If the monitored socket does not exist, or when the monitor is triggered, a 'DOWN' message is sent that has the following pattern:
{'DOWN', MonitorRef, Type, Object, Info}
MonitorRefβ The identity of the socket.Typeβ The type of socket, can be one of the following atoms:portorsocket.Objectβ The monitored entity, the socket, which triggered the event.Infoβ Either the termination reason of the socket ornosock(socket Socket did not exist at the time of monitor creation).
Making several calls to inet:monitor/1 for the same Socket is not an error β it results in as many independent monitoring instances π So go off, monitor her as many times as you want.
π§ͺ is_ip_address(IPAddress) -> boolean()
Types:
IPAddress = ip_address() | term()
Tests if IPAddress is an ip_address() and returns true if so, otherwise false β Simple, clean, does exactly what it says on the tin.
π§ͺπ§ͺ is_ipv4_address(IPv4Address) -> boolean()
Types:
IPv4Address = ip4_address() | term()
Tests if IPAddress is an ip4_address() and returns true if so, otherwise false πΈ And yes bestie, the argument's named IPv4Address and the text says IPAddress β that's literally what the docs say, I'm not touching it π
π¦ is_ipv6_address(IPv6Address) -> boolean()
Types:
IPv6Address = ip6_address() | term()
Okay so this one is basically a vibe check for your address: it tests if IPAddress is an ip6_address() and returns true if so, otherwise false. No cap, thatβs it.
π ntoa(IpAddress) -> Address | {error, einval}
Types:
Address = string()
IpAddress = ip_address()
Parses an ip_address() and returns an IPv4 or IPv6 address string. Itβs giving βturn the number back into something your group chat can read.β π
β¨ parse_address(Address) -> {ok, IPAddress} | {error, einval}
Types:
Address = string()
IPAddress = ip_address()
Parses an IPv4 or IPv6 address string and returns an ip4_address() or ip6_address(). Accepts a shortened IPv4 address string. Lowkey flexible, highkey useful. π«Ά
πΈ parse_ipv4_address(Address) -> {ok, IPv4Address} | {error, einval}
Types:
Address = string()
IPv4Address = ip4_address()
Parses an IPv4 address string and returns an ip4_address(). Accepts a shortened IPv4 address string. Iconic IPv4-only behavior.
π§ parse_ipv4strict_address(Address) -> {ok, IPv4Address} | {error, einval}
Types:
Address = string()
IPv4Address = ip4_address()
Parses an IPv4 address string containing four fields, that is, not shortened, and returns an ip4_address(). Strict queen energy: no shortcuts allowed. π
π₯ parse_ipv6_address(Address) -> {ok, IPv6Address} | {error, einval}
Types:
Address = string()
IPv6Address = ip6_address()
Parses an IPv6 address string and returns an ip6_address(). If an IPv4 address string is specified, an IPv4-mapped IPv6 address is returned. The way it just maps things? Obsessed.
π parse_ipv6strict_address(Address) -> {ok, IPv6Address} | {error, einval}
Types:
Address = string()
IPv6Address = ip6_address()
Parses an IPv6 address string and returns an ip6_address(). Does not accept IPv4 addresses. Strictly IPv6, bestie. No sneaky IPv4 sneaking in. π
π ipv4_mapped_ipv6_address(X1 :: ip_address()) -> ip_address()
Convert an IPv4 address to an IPv4-mapped IPv6 address or the reverse. When converting from an IPv6 address all but the 2 low words are ignored so this function also works on some other types of addresses than IPv4-mapped. Itβs giving βsame energy, different format.β π¦
π parse_strict_address(Address) -> {ok, IPAddress} | {error, einval}
Types:
Address = string()
IPAddress = ip_address()
Parses an IPv4 or IPv6 address string and returns an ip4_address() or ip6_address(). Does not accept a shortened IPv4 address string. Strict mode: activated. π
π peername(Socket :: socket()) -> {ok, {ip_address(), port_number()} | returned_non_ip_address()} | {error, posix()}
Returns the address and port for the other end of a connection.
Notice that for SCTP sockets, this function returns only one of the peer addresses of the socket. Function peernames/1,2 returns all. So yeah, this one is the βjust give me oneβ version. π
π¦ peernames(Socket :: socket()) -> {ok, [{ip_address(), port_number()} | returned_non_ip_address()]} | {error, posix()}
Equivalent to peernames(Socket, 0).
Notice that the behavior of this function for an SCTP one-to-many style socket is not defined by the SCTP Sockets API Extensions. So likeβ¦ proceed with caution, bestie. β οΈ
πΈ peernames(Socket, Assoc) -> {ok, [{Address, Port}]} | {error, posix()}
Types:
Socket = socket()
Assoc = #sctp_assoc_change{} | gen_sctp:assoc_id()
Address = ip_address()
Port = integer() >= 0
Returns a list of all address/port number pairs for the other end of an association Assoc of a socket.
This function can return multiple addresses for multihomed sockets, such as SCTP sockets. For other sockets it returns a one-element list. So if you get a list with one thing in it, thatβs not a bug, thatβs just the vibe. π
Notice that parameter Assoc is by the SCTP Sockets API Extensions defined to be ignored for one-to-one style sockets. What the special value 0 means, hence its behavior for one-to-many style sockets, is unfortunately undefined. Yeahβ¦ thatβs a little βiykykβ but also kinda π.
π port(Socket) -> {ok, Port} | {error, any()}
Types:
Socket = socket()
Port = port_number()
Returns the local port number for a socket. Your socketβs little home address, fr fr. π
β¨ setopts(Socket, Options) -> ok | {error, posix()}
Types:
Socket = socket()
Options = [socket_setopt()]
Sets one or more options for a socket.
The following options are available:
{active, true | false | once | N}β okay so this is the big one, listen up bestie.
If the value is true, which is the default, everything received from the socket is sent as messages to the receiving process.
If the value is false (passive mode), the process must explicitly receive incoming data by calling gen_tcp:recv/2,3, gen_udp:recv/2,3, or gen_sctp:recv/1,2 (depending on the type of socket).
If the value is once ({active, once}), one data message from the socket is sent to the process. To receive one more message, setopts/2 must be called again with option {active, once}.
If the value is an integer N in the range -32768 to 32767 (inclusive), the value is added to the socket's count of data messages sent to the controlling process. A socket's default message count is 0. If a negative value is specified, and its magnitude is equal to or greater than the socket's current message count, the socket's message count is set to 0. Once the socket's message count reaches 0, either because of sending received data messages to the process or by being explicitly set, the process is then notified by a special message, specific to the type of socket, that the socket has entered passive mode. Once the socket enters passive mode, to receive more messages setopts/2 must be called again to set the socket back into an active mode.
When using {active, once} or {active, N}, the socket changes behavior automatically when data is received. This can be confusing in combination with connection-oriented sockets (that is, gen_tcp), as a socket with {active, false} behavior reports closing differently than a socket with {active, true} behavior. To simplify programming, a socket where the peer closed, and this is detected while in {active, false} mode, still generates message {tcp_closed,Socket} when set to {active, once}, {active, true}, or {active, N} mode. It is therefore safe to assume that message {tcp_closed,Socket}, possibly followed by socket port termination (depending on option exit_on_close) eventually appears when a socket changes back and forth between {active, true} and {active, false} mode. However, when peer closing is detected it is all up to the underlying TCP/IP stack and protocol.
Notice that {active, true} mode provides no flow control; a fast sender can easily overflow the receiver with incoming messages. The same is true for {active, N} mode, while the message count is greater than zero.
Use active mode only if your high-level protocol provides its own flow control (for example, acknowledging received messages) or the amount of data exchanged is small. {active, false} mode, use of the {active, once} mode, or {active, N} mode with values of N appropriate for the application provides flow control. The other side cannot send faster than the receiver can read. Slay for backpressure. π
{broadcast, Boolean}(UDP sockets) β enables/disables permission to send broadcasts. UDP girlies know.{buffer, Size}β the size of the user-level buffer used by the driver. Not to be confused with optionssndbufandrecbuf, which correspond to the Kernel socket buffers. For TCP it is recommended to haveval(buffer) >= val(recbuf)to avoid performance issues because of unnecessary copying. For UDP the same recommendation applies, but the max should not be larger than the MTU of the network path.val(buffer)is automatically set to the above maximum whenrecbufis set. However, as the size set forrecbufusually become larger, you are encouraged to usegetopts/2to analyze the behavior of your operating system.
Note that this is also the maximum amount of data that can be received from a single recv call. If you are using higher than normal MTU consider setting buffer higher.
{delay_send, Boolean}β normally, when an Erlang process sends to a socket, the driver tries to send the data immediately. If that fails, the driver uses any means available to queue up the message to be sent whenever the operating system says it can handle it. Setting{delay_send, true}makes all messages queue up. The messages sent to the network are then larger but fewer. The option affects the scheduling of send requests versus Erlang processes instead of changing any real property of the socket. The option is implementation-specific. Defaults tofalse.{deliver, port | term}β when{active, true}, data is delivered on the formport : {S, {data, [H1,..Hsz | Data]}}orterm : {tcp, S, [H1..Hsz | Data]}.{dontroute, Boolean}β enables/disables routing bypass for outgoing messages.{exit_on_close, Boolean}β this option is set totrueby default.
The only reason to set it to false is if you want to continue sending data to the socket after a close is detected, for example, if the peer uses gen_tcp:shutdown/2 to shut down the write side. Careful with that one, bestie.
{header, Size}β this option is only meaningful if optionbinarywas specified when the socket was created. If optionheaderis specified, the firstSizenumber bytes of data received from the socket are elements of a list, and the remaining data is a binary specified as the tail of the same list. For example, ifSize == 2, the data received matches[Byte1,Byte2|Binary]. Cute little header moment. π{high_msgq_watermark, Size}β okay so this is the βmsgq is getting fullβ vibe check, bestie. The socket message queue flips into a busy state the moment the amount of data sitting on it reaches this limit. Heads up: this limit only concerns data that has not yet reached the ERTS internal socket implementation. Defaults to8 kB.
Senders of data to the socket are suspended if either the socket message queue is busy or the socket itself is busy. No cap.
For more information, see options low_msgq_watermark, high_watermark, and low_watermark.
Notice: distribution sockets disable the use ofhigh_msgq_watermarkandlow_msgq_watermark. Instead use the distribution buffer busy limit, which is a similar feature. π
{high_watermark, Size} (TCP/IP sockets)β this one is the socket-level busy trigger. The socket is set to a busy state when the amount of data queued internally by the ERTS socket implementation reaches this limit. Defaults to8 kB.
Senders of data to the socket are suspended if either the socket message queue is busy or the socket itself is busy.
For more information, see options low_watermark, high_msgq_watermark, and low_msqg_watermark. β¨
{ipv6_v6only, Boolean}β this restricts the socket to use only IPv6, prohibiting any IPv4 connections. This is only applicable for IPv6 sockets (optioninet6). π¦
On most platforms this option must be set on the socket before associating it to an address. It is therefore only reasonable to specify it when creating the socket and not to use it when calling function (setopts/2) containing this description.
The behavior of a socket with this option set to true is the only portable one. The original idea when IPv6 was new of using IPv6 for all traffic is now not recommended by FreeBSD (you can use {ipv6_v6only,false} to override the recommended system default value), forbidden by OpenBSD (the supported GENERIC kernel), and impossible on Windows (which has separate IPv4 and IPv6 protocol stacks). Most Linux distros still have a system default value of false. This policy shift among operating systems to separate IPv6 from IPv4 traffic has evolved, as it gradually proved hard and complicated to get a dual stack implementation correct and secure.
On some platforms, the only allowed value for this option is true, for example, OpenBSD and Windows. Trying to set this option to false, when creating the socket, fails in this case.
Setting this option on platforms where it does not exist is ignored. Getting this option with getopts/2 returns no value, that is, the returned list does not contain an {ipv6_v6only,_} tuple. On Windows, the option does not exist, but it is emulated as a read-only option with value true.
Therefore, setting this option to true when creating a socket never fails, except possibly on a platform where you have customized the kernel to only allow false, which can be doable (but awkward) on, for example, OpenBSD.
If you read back the option value using getopts/2 and get no value, the option does not exist in the host operating system. The behavior of both an IPv6 and an IPv4 socket listening on the same port, and for an IPv6 socket getting IPv4 traffic is then no longer predictable. π¬
{keepalive, Boolean}(TCP/IP sockets)β toggles periodic transmission on a connected socket when no other data is exchanged. If the other end does not respond, the connection is considered broken and an error message is sent to the controlling process. Defaults tofalse. π«Ά{linger, {true|false, Seconds}}β sets the time-out, in seconds, for flushing unsent data in theclose/1socket call.
The first component is if linger is enabled, the second component is the flushing time-out, in seconds. There are 3 alternatives:
{false, _}βclose/1orshutdown/2returns immediately, not waiting for data to be flushed, with closing happening in the background.{true, 0}β aborts the connection when it is closed. Discards any data still remaining in the send buffers and sendsRSTto the peer. This avoids TCP'sTIME_WAITstate, but leaves open the possibility that another "incarnation" of this connection being created. π{true, Time}whenTime > 0βclose/1orshutdown/2will not return until all queued messages for the socket have been successfully sent or the linger timeout (Time) has been reached.
{low_msgq_watermark, Size}β if the socket message queue is in a busy state, the socket message queue is set in a not busy state when the amount of data queued in the message queue falls below this limit. Notice that this limit only concerns data that has not yet reached the ERTS internal socket implementation. Defaults to4 kB.
Senders that are suspended because of either a busy message queue or a busy socket are resumed when the socket message queue and the socket are not busy.
For more information, see options high_msgq_watermark, high_watermark, and low_watermark.
Notice: distribution sockets disable the use ofhigh_msgq_watermarkandlow_msgq_watermark. Instead they use the distribution buffer busy limit, which is a similar feature. πΈ
{low_watermark, Size} (TCP/IP sockets)β if the socket is in a busy state, the socket is set in a not busy state when the amount of data queued internally by the ERTS socket implementation falls below this limit. Defaults to4 kB.
Senders that are suspended because of a busy message queue or a busy socket are resumed when the socket message queue and the socket are not busy.
For more information, see options high_watermark, high_msgq_watermark, and low_msgq_watermark. π
{mode, Mode :: binary | list}β Received Packet is delivered as defined by Mode. π{netns, Namespace :: file:filename_all()}β sets a network namespace for the socket. Parameter Namespace is a filename defining the namespace, for example,"/var/run/netns/example", typically created by commandip netns add example. This option must be used in a function call that creates a socket, that is,gen_tcp:connect/3,4,gen_tcp:listen/2,gen_udp:open/1,2orgen_sctp:open/0,1,2, and alsogetifaddrs/1. π¦
This option uses the Linux-specific syscall setns(), such as in Linux kernel 3.0 or later, and therefore only exists when the runtime system is compiled for such an operating system.
The virtual machine also needs elevated privileges, either running as superuser or (for Linux) having capability CAP_SYS_ADMIN according to the documentation for setns(2). However, during testing also CAP_SYS_PTRACE and CAP_DAC_READ_SEARCH have proven to be necessary.
Example:
setcap cap_sys_admin,cap_sys_ptrace,cap_dac_read_search+epi beam.smp
Notice that the filesystem containing the virtual machine executable (beam.smp in the example) must be local, mounted without flag nosetuid, support extended attributes, and the kernel must support file capabilities. All this runs out of the box on at least Ubuntu 12.04 LTS, except that SCTP sockets appear to not support network namespaces. π
Namespace is a filename and is encoded and decoded as discussed in module file, with the following exceptions:
- Emulator flag
+fnuis ignored. getopts/2for this option returns a binary for the filename if the stored filename cannot be decoded. This is only to occur if you set the option using a binary that cannot be decoded with the emulator's filename encoding:file:native_name_encoding/0.
{bind_to_device, Ifname :: binary()}β binds a socket to a specific network interface. This option must be used in a function call that creates a socket, that is,gen_tcp:connect/3,4,gen_tcp:listen/2,gen_udp:open/1,2, orgen_sctp:open/0,1,2. π
Unlike getifaddrs/0, Ifname is encoded a binary. In the unlikely case that a system is using non-7-bit-ASCII characters in network device names, special care has to be taken when encoding this argument.
This option uses the Linux-specific socket option SO_BINDTODEVICE, such as in Linux kernel 2.0.30 or later, and therefore only exists when the runtime system is compiled for such an operating system.
Before Linux 3.8, this socket option could be set, but could not be retrieved with getopts/2. Since Linux 3.8, it is readable.
The virtual machine also needs elevated privileges, either running as superuser or (for Linux) having capability CAP_NET_RAW.
The primary use case for this option is to bind sockets into Linux VRF instances.
listβ Received Packet is delivered as a list. πbinaryβ Received Packet is delivered as a binary. π§{nodelay, Boolean}(TCP/IP sockets)β ifBoolean == true, optionTCP_NODELAYis turned on for the socket, which means that also small amounts of data are sent immediately. β‘
This option is not supported for domain = local, but if inet_backend =/= socket this error will be ignored.
{nopush, Boolean}(TCP/IP sockets)β this translates toTCP_NOPUSHon BSD and toTCP_CORKon Linux. π
So when Boolean == true, the corresponding option is turned on for the socket, which means small amounts of data are accumulated until a full MSS-worth of data is available or this option is turned off. π
Also, real talk: even though the TCP_NOPUSH socket option is available on OSX, its semantics is very different (e.g., unsetting it does not cause immediate send of accumulated data). Hence, the nopush option is intentionally ignored on OSX. π«Ά
{packet, PacketType}(TCP/IP sockets) β Defines the type of packets to use for a socket. Possible values are:raw|0β No packaging is done.1|2|4β Packets consist of a header specifying the number of bytes in the packet, followed by that number of bytes. The header length can be one, two, or four bytes, and containing an unsigned integer in big-endian byte order. Each send operation generates the header, and the header is stripped off on each receive operation. The 4-byte header is limited to2Gb.asn1|cdr|sunrm|fcgi|tpkt|lineβ These packet types only have effect on receiving. When sending a packet, it is the responsibility of the application to supply a correct header. On receiving, however, one message is sent to the controlling process for each complete packet received, and, similarly, each call togen_tcp:recv/2,3returns one complete packet. The header is not stripped off. The meanings of the packet types are as follows:asn1β ASN.1 BERsunrmβ Sun's RPC encodingcdrβ CORBA (GIOP 1.1)fcgiβ Fast CGItpktβ TPKT format [RFC1006]lineβ Line mode, a packet is a line-terminated with newline, lines longer than the receive buffer are truncated
http|http_binβ The Hypertext Transfer Protocol. The packets are returned with the format according toHttpPacketdescribed inerlang:decode_packet/3in ERTS. A socket in passive mode returns{ok, HttpPacket}fromgen_tcp:recvwhile an active socket sends messages like{http, Socket, HttpPacket}.httph|httph_binβ These two types are often not needed, as the socket automatically switches fromhttp/http_bintohttph/httph_bininternally after the first line is read. However, there can be occasions when they are useful, such as parsing trailers from chunked encoding.
{packet_size, Integer}(TCP/IP sockets) β Sets the maximum allowed length of the packet body. If the packet header indicates that the length of the packet is longer than the maximum allowed length, the packet is considered invalid. The same occurs if the packet header is too large for the socket receive buffer. For line-oriented protocols (line,http*), optionpacket_sizealso guarantees that lines up to the indicated length are accepted and not considered invalid because of internal buffer limitations.{line_delimiter, Char}(TCP/IP sockets) β Sets the line delimiting character for line-oriented protocols (line). Defaults to$\n.{raw, Protocol, OptionNum, ValueBin}β See below.{read_packets, Integer}(UDP sockets) β Sets the maximum number of UDP packets to read without intervention from the socket when data is available. When this many packets have been read and delivered to the destination process, new packets are not read until a new notification of available data has arrived. Defaults to5. If this parameter is set too high, the system can become unresponsive because of UDP packet flooding. π{recbuf, Size}β The minimum size of the receive buffer to use for the socket. You are encouraged to usegetopts/2to retrieve the size set by your operating system.{recvtclass, Boolean}β If set totrue, activates returning the receivedTCLASSvalue on platforms that implements the protocolIPPROTO_IPV6optionIPV6_RECVTCLASSorIPV6_2292RECVTCLASSfor the socket. The value is returned as a{tclass,TCLASS}tuple regardless of if the platform returns anIPV6_TCLASSor anIPV6_RECVTCLASSCMSG value. For packet oriented sockets that supports receiving ancillary data with the payload data (gen_udpandgen_sctp), theTCLASSvalue is returned in an extended return tuple contained in an ancillary data list. For stream oriented sockets (gen_tcp), the only way to get theTCLASSvalue is if the platform supports thepktoptionsoption.{recvtos, Boolean}β If set totrue, activates returning the receivedTOSvalue on platforms that implements the protocolIPPROTO_IPoptionIP_RECVTOSfor the socket. The value is returned as a{tos,TOS}tuple regardless of if the platform returns anIP_TOSor anIP_RECVTOSCMSG value. For packet oriented sockets that supports receiving ancillary data with the payload data (gen_udpandgen_sctp), theTOSvalue is returned in an extended return tuple contained in an ancillary data list. For stream oriented sockets (gen_tcp), the only way to get theTOSvalue is if the platform supports thepktoptionsoption.{recvttl, Boolean}β If set totrue, activates returning the receivedTTLvalue on platforms that implements the protocolIPPROTO_IPoptionIP_RECVTTLfor the socket. The value is returned as a{ttl,TTL}tuple regardless of if the platform returns anIP_TTLor anIP_RECVTTLCMSG value. For packet oriented sockets that supports receiving ancillary data with the payload data (gen_udpandgen_sctp), theTTLvalue is returned in an extended return tuple contained in an ancillary data list. For stream oriented sockets (gen_tcp), the only way to get theTTLvalue is if the platform supports thepktoptionsoption.{reuseaddr, Boolean}β Allows or disallows local reuse of address. By default, reuse is disallowed.
Note: On Windows this option will be ignored unlessSocketis an UDP socket. This since the behavior ofreuseaddris very different on Windows compared to other system.
{send_timeout, Integer}β Only allowed for connection-oriented sockets. Specifies a longest time to wait for a send operation to be accepted by the underlying TCP stack. When the limit is exceeded, the send operation returns{error,timeout}. How much of a packet that got sent is unknown; the socket is therefore to be closed whenever a time-out has occurred (seesend_timeout_closebelow). Defaults toinfinity.{send_timeout_close, Boolean}β Only allowed for connection-oriented sockets. Used together withsend_timeoutto specify whether the socket is to be automatically closed when the send operation returns{error,timeout}. The recommended setting istrue, which automatically closes the socket. Defaults tofalsebecause of backward compatibility.{show_econnreset, Boolean}(TCP/IP sockets) β When this option is set tofalse, which is default, an RST received from the TCP peer is treated as a normal close (as though an FIN was sent). A caller togen_tcp:recv/2gets{error, closed}. In active mode, the controlling process receives a{tcp_closed, Socket}message, indicating that the peer has closed the connection. Setting this option totrueallows you to distinguish between a connection that was closed normally, and one that was aborted (intentionally or unintentionally) by the TCP peer. A call togen_tcp:recv/2returns{error, econnreset}. In active mode, the controlling process receives a{tcp_error, Socket, econnreset}message before the usual{tcp_closed, Socket}, as is the case for any other socket error. Calls togen_tcp:send/2also returns{error, econnreset}when it is detected that a TCP peer has sent an RST. A connected socket returned fromgen_tcp:accept/1inherits theshow_econnresetsetting from the listening socket.{sndbuf, Size}β The minimum size of the send buffer to use for the socket. You are encouraged to usegetopts/2, to retrieve the size set by your operating system.{priority, Integer}β Sets theSO_PRIORITYsocket level option on platforms where this is implemented. The behavior and allowed range varies between different systems. The option is ignored on platforms where it is not implemented. Use with caution. β οΈ{tos, Integer}β SetsIP_TOSIP level options on platforms where this is implemented. The behavior and allowed range varies between different systems. The option is ignored on platforms where it is not implemented. Use with caution. β οΈ{tclass, Integer}β SetsIPV6_TCLASSIP level options on platforms where this is implemented. The behavior and allowed range varies between different systems. The option is ignored on platforms where it is not implemented. Use with caution. β οΈ
Okay so, in addition to all those options up there, raw option specifications can be used. The raw options are specified as a tuple of arity four, beginning with tag raw, followed by the protocol level, the option number, and the option value specified as a binary. This corresponds to the second, third, and fourth arguments to the setsockopt call in the C socket API. The option value must be coded in the native endianness of the platform and, if a structure is required, must follow the structure alignment conventions on the specific platform. π
Using raw socket options requires detailed knowledge about the current operating system and TCP stack. No cap β this is not the cozy beginner zone, bestie.
Example:
This example concerns the use of raw options. Consider a Linux system where you want to set option TCP_LINGER2 on protocol level IPPROTO_TCP in the stack. You know that on this particular system it defaults to 60 (seconds), but you want to lower it to 30 for a particular socket. Option TCP_LINGER2 is not explicitly supported by inet, but you know that the protocol level translates to number 6, the option number to number 8, and the value is to be specified as a 32-bit integer. You can use this code line to set the option for the socket named Sock:
inet:setopts(Sock,[{raw,6,8,<<30:32/native>>}]),
As many options are silently discarded by the stack if they are specified out of range; it can be a good idea to check that a raw option is accepted. The following code places the value in variable TcpLinger2:
{ok,[{raw,6,8,<<TcpLinger2:32/native>>}]}=inet:getopts(Sock,[{raw,6,8,4}]),
Code such as these examples is inherently non-portable, even different versions of the same OS on the same platform can respond differently to this kind of option manipulation. Use with care, fr fr. π«Ά
Notice that the default options for TCP/IP sockets can be changed with the Kernel configuration parameters mentioned in the beginning of this manual page. β¨
πΈ sockname/1 πΈ
sockname(Socket :: socket()) ->
{ok,
{ip_address(), port_number()} |
returned_non_ip_address()} |
{error, posix()}
Returns the local address and port number for a socket.
Notice that for SCTP sockets this function returns only one of the socket addresses. Function socknames/1,2 returns all. π
π socknames/1 π
socknames(Socket :: socket()) ->
{ok,
[{ip_address(), port_number()} |
returned_non_ip_address()]} |
{error, posix()}
Equivalent to socknames(Socket, 0).
π¦ socknames/2 π¦
socknames(Socket, Assoc) ->
{ok, [{Address, Port}]} | {error, posix()}
Types:
Socket = socket()
Assoc = #sctp_assoc_change{} | gen_sctp:assoc_id()
Address = ip_address()
Port = integer() >= 0
Returns a list of all local address/port number pairs for a socket for the specified association Assoc.
This function can return multiple addresses for multihomed sockets, such as SCTP sockets. For other sockets it returns a one-element list.
Notice that parameter Assoc is by the SCTP Sockets API Extensions defined to be ignored for one-to-one style sockets. For one-to-many style sockets, the special value 0 is defined to mean that the returned addresses must be without any particular association. How different SCTP implementations interpret this varies somewhat. π
π POSIX ERROR CODES π
Bestie, here is the whole posix error-code lineup β every single one, in order, no skipping, no editing. π
e2bigβ Too long argument listeaccesβ Permission deniedeaddrinuseβ Address already in useeaddrnotavailβ Cannot assign requested addresseadvβ Advertise erroreafnosupportβ Address family not supported by protocol familyeagainβ Resource temporarily unavailableealignβ EALIGNealreadyβ Operation already in progressebadeβ Bad exchange descriptorebadfβ Bad file numberebadfdβ File descriptor in bad stateebadmsgβ Not a data messageebadrβ Bad request descriptorebadrpcβ Bad RPC structureebadrqcβ Bad request codeebadsltβ Invalid slotebfontβ Bad font file formatebusyβ File busyechildβ No childrenechrngβ Channel number out of rangeecommβ Communication error on sendeconnabortedβ Software caused connection aborteconnrefusedβ Connection refusedeconnresetβ Connection reset by peeredeadlkβ Resource deadlock avoidededeadlockβ Resource deadlock avoidededestaddrreqβ Destination address requirededirtyβ Mounting a dirty fs without forceedomβ Math argument out of rangeedotdotβ Cross mount pointedquotβ Disk quota exceedededuppkgβ Duplicate package nameeexistβ File already existsefaultβ Bad address in system call argumentefbigβ File too largeehostdownβ Host is downehostunreachβ Host is unreachableeidrmβ Identifier removedeinitβ Initialization erroreinprogressβ Operation now in progresseintrβ Interrupted system calleinvalβ Invalid argumenteioβ I/O erroreisconnβ Socket is already connectedeisdirβ Illegal operation on a directoryeisnamβ Is a named fileel2hltβ Level 2 haltedel2nsyncβ Level 2 not synchronizedel3hltβ Level 3 haltedel3rstβ Level 3 resetelbinβ ELBINelibaccβ Cannot access a needed shared libraryelibbadβ Accessing a corrupted shared libraryelibexecβ Cannot exec a shared library directlyelibmaxβ Attempting to link in more shared libraries than system limitelibscnβ.libsection in a.out corruptedelnrngβ Link number out of rangeeloopβ Too many levels of symbolic linksemfileβ Too many open filesemlinkβ Too many linksemsgsizeβ Message too longemultihopβ Multihop attemptedenametoolongβ Filename too longenavailβ Unavailableenetβ ENETenetdownβ Network is downenetresetβ Network dropped connection on resetenetunreachβ Network is unreachableenfileβ File table overflowenoanoβ Anode table overflowenobufsβ No buffer space availableenocsiβ No CSI structure availableenodataβ No data availableenodevβ No such deviceenoentβ No such file or directoryenoexecβ Exec format errorenolckβ No locks availableenolinkβ Link has been severedenomemβ Not enough memoryenomsgβ No message of desired typeenonetβ Machine is not on the networkenopkgβ Package not installedenoprotooptβ Bad protocol optionenospcβ No space left on deviceenosrβ Out of stream resources or not a stream deviceenosymβ Unresolved symbol nameenosysβ Function not implementedenotblkβ Block device requiredenotconnβ Socket is not connectedenotdirβ Not a directoryenotemptyβ Directory not emptyenotnamβ Not a named fileenotsockβ Socket operation on non-socketenotsupβ Operation not supportedenottyβ Inappropriate device for ioctlenotuniqβ Name not unique on networkenxioβ No such device or addresseopnotsuppβ Operation not supported on socketepermβ Not ownerepfnosupportβ Protocol family not supportedepipeβ Broken pipeeproclimβ Too many processeseprocunavailβ Bad procedure for programeprogmismatchβ Wrong program versioneprogunavailβ RPC program unavailableeprotoβ Protocol erroreprotonosupportβ Protocol not supportedeprototypeβ Wrong protocol type for socketerangeβ Math result unrepresentableerefusedβ EREFUSEDeremchgβ Remote address changederemdevβ Remote deviceeremoteβ Pathname hit remote filesystemeremoteioβ Remote I/O erroreremotereleaseβ EREMOTERELEASEerofsβ Read-only filesystemerpcmismatchβ Wrong RPC versionerremoteβ Object is remoteeshutdownβ Cannot send after socket shutdownesocktnosupportβ Socket type not supportedespipeβ Invalid seekesrchβ No such processesrmntβ Srmount errorestaleβ Stale remote file handleesuccessβ Error 0etimeβ Timer expiredetimedoutβ Connection timed outetoomanyrefsβ Too many referencesetxtbsyβ Text file or pseudo-device busyeucleanβ Structure needs cleaningeunatchβ Protocol driver not attachedeusersβ Too many userseversionβ Version mismatchewouldblockβ Operation would blockexdevβ Cross-domain linkexfullβ Message tables fullnxdomainβ Hostname or domain name cannot be found
π Big footer kiss to Ericsson AB, kernel 8.5.4.2, and inet(3erl) β source, version, page, done, love u! π
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms