# dns

<a id="dns"></a>

# dns

DNS utilities.

## Functions

| Return | Name | Description |
|--------|------|-------------|
| `auto` | [`resolve`](#resolve-1) `inline` | Resolves a hostname to a network address asynchronously. |

---

<a id="resolve-1"></a>

### resolve

`inline`

```cpp
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](https://github.com/auscaster/icey/blob/main/src/net/include/icy/net/dns.h#L38)

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](https://auscaster.com/icey/docs/api-reference/icy-net-Address.md#address). 
#### Returns
A request handle whose lifetime controls the in-flight DNS query.

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `host` | `const std::string &` | Hostname or IP address string to resolve. |
| `port` | `int` | Port number to associate with the resolved address. |
| `callback` | std::function< void(int, const [`net::Address`](https://auscaster.com/icey/docs/api-reference/icy-net-Address.md#address) &)> | Invoked with (status, resolved [Address](https://auscaster.com/icey/docs/api-reference/icy-net-Address.md#address)); status is 0 on success. |
| `loop` | [`uv::Loop`](https://auscaster.com/icey/docs/api-reference/uv.md#loop-1) * | Event loop to use; defaults to the default loop. |
