Module inet

Data Types

address()


address() = ipv4_address()

hostname()


hostname() = iodata()

ipv4_address()


ipv4_address() = {octet(), octet(), octet(), octet()}

octet()


octet() = 0..255

port_number()


port_number() = 0..65535

socket()


socket() = pid()

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