main-apidocs-erlang-estdlib-net.md
addrinfo() = #{family => socket:domain(), socktype => socket:type(), protocol => socket:protocol(), address => socket:sockaddr(), addr => socket:sockaddr()}
service() = string()
| getaddrinfo/1 | Retrieve address information for a given hostname. | | getaddrinfo/2 | Retrieve address information for a given hostname and service. | | gethostname/0 | Get the hostname. |
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(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.
gethostname() -> {ok, string()} | {error, any()}
returns: The (usually short) name of the host.
Get the hostname