boost::corosio::resolver
An asynchronous DNS resolver for coroutine I/O.
Synopsis
Declared in <boost/corosio/resolver.hpp>
class resolver
: public io_object
Description
This class provides asynchronous DNS resolution operations that return awaitable types. Each operation participates in the affine awaitable protocol, ensuring coroutines resume on the correct executor.
Thread Safety
Distinct objects: Safe. Shared objects: Unsafe. A resolver must not have concurrent resolve operations.
Semantics
Wraps platform DNS resolution (getaddrinfo/getnameinfo). Operations dispatch to OS resolver APIs via the io_context thread pool.
Example
io_context ioc;
resolver r(ioc);
// Using structured bindings
auto [ec, results] = co_await r.resolve("www.example.com", "https");
if (ec)
co_return;
for (auto const& entry : results)
std::cout << entry.get_endpoint().port() << std::endl;
// Or using exceptions
auto results = (co_await r.resolve("www.example.com", "https")).value();
Types
Name |
Description |
RAII wrapper for I/O object implementation lifetime. |
|
Forward declaration for platform‐specific implementation. |
|
Base interface for platform I/O implementations. |
|
Service interface for I/O object lifecycle management. |
|
Member Functions
Name |
Description |
|
Constructors |
|
Destructor. |
|
Move assignment operator. |
Cancel any pending asynchronous operations. |
|
Return the execution context. |
|
|
Protected Data Members
Name |
Created with MrDocs