Net module

dns

DNS utilities.

Functions

ReturnNameDescription
autoresolve inlineResolves a hostname to a network address asynchronously.

resolve

inline

inline auto resolve(const std::string & host, int port, std::function< void(int, const net::Address &)> callback, uv::Loop * loop = uv::defaultLoop())

Defined in src/net/include/icy/net/dns.h:38

Resolves a hostname to a network address asynchronously.

The callback is invoked on the event loop thread when resolution completes. On failure, the callback receives a non-zero status and an empty Address.

Returns

A request handle whose lifetime controls the in-flight DNS query.

Parameters

ParameterTypeDescription
hostconst std::string &Hostname or IP address string to resolve.
portintPort number to associate with the resolved address.
callbackstd::function< void(int, const net::Address &)>Invoked with (status, resolved Address); status is 0 on success.
loopuv::Loop *Event loop to use; defaults to the default loop.