Module inet
Data Types
address_family()
address_family() = inet
hostname()
hostname() = atom() | string()
ip4_address()
ip4_address() = {0..255, 0..255, 0..255, 0..255}
ip_address()
ip_address() = ip4_address()
moniker()
moniker() = ?GEN_TCP_MONIKER | ?GEN_UDP_MONIKER
port_number()
port_number() = 0..65535
socket()
socket() = {moniker(), socket_impl(), module()}
socket_impl()
socket_impl() = any()
Function Index
close/1 | Close the socket. |
getaddr/2 | Get the IP address associated with a given name. |
peername/1 | The address and port representing the "remote" end of a connection. |
port/1 | Retrieve the actual port number to which the socket is bound. |
sockname/1 | The address and port representing the "local" end of a connection. |
Function Details
close/1
close(Socket::socket()) -> ok
Socket
: the socket to close
returns: ok.
Close the socket.
getaddr/2
getaddr(Name::ip_address() | hostname(), Family::address_family()) -> {ok, ip_address()} | {error, Reason::term()}
Name
: the name to resolveFamily
: the family to resolve it to
returns: The address or an error tuple.
Get the IP address associated with a given name.
peername/1
peername(Socket::socket()) -> {ok, {ip_address(), port_number()}} | {error, Reason::term()}
Socket
: the socket
returns: The address and port of the remote end of an established connection.
The address and port representing the “remote” end of a connection. This function should be called on a running socket instance.
port/1
port(Socket::socket()) -> port_number()
Socket
: the socket from which to obtain the port number
returns: the port number associated with the local socket
Retrieve the actual port number to which the socket is bound. This function is useful if the port assignment is done by the operating system.
sockname/1
sockname(Socket::socket()) -> {ok, {ip_address(), port_number()}} | {error, Reason::term()}
Socket
: the socket
returns: The address and port of the local end of an established connection.
The address and port representing the “local” end of a connection. This function should be called on a running socket instance.