Module net

Data Types

addrinfo()


addrinfo() = #{family => socket:domain(), socktype => socket:type(), protocol => socket:protocol(), address => socket:sockaddr(), addr => socket:sockaddr()}

service()


service() = string()

Function Index

getaddrinfo/1 Retrieve address information for a given hostname.
getaddrinfo/2 Retrieve address information for a given hostname and service.

Function Details

getaddrinfo/1


getaddrinfo(Host::string()) -> {ok, AddrInfo::addrinfo()} | {error, Reason::term()}

Host: the host string for which to find address information

returns: Address info for the specified host

Equivalent to getaddrinfo(Host, undefined).

Retrieve address information for a given hostname.

getaddrinfo/2


getaddrinfo(Host::string() | undefined, Service::service() | undefined) -> {ok, AddrInfo::addrinfo()} | {error, Reason::term()}

Host: the host string for which to find address information
Service: the service string for which to find address information

returns: Address info for the specified host and service

Retrieve address information for a given hostname and service.

The Host parameter may be a fully qualified host name or a string containing a valid dotted pair IP address. (Currently, only IPv4 is supported).

The Service parameter may be the name of a service (as defined via services(3) or a string containing a decimal value of the same.

Note that the Host or String parameter may be undefined, but not both.