Module inet

Data Types

hostname()


hostname() = iodata()

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.
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.

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.