AsyncFw 1.2
Async Framework is c++ runtime with timers, poll notifiers, sockets, coroutines, etc.
 
Loading...
Searching...
No Matches
AsyncFw::AddressInfo Class Reference

The AddressInfo class. More...

#include <AsyncFw/AddressInfo>

Collaboration diagram for AsyncFw::AddressInfo:
[legend]

Public Types

enum  Family : uint8_t { Unspec = AF_UNSPEC_ , Inet = AF_INET_ , Inet6 = AF_INET6_ }
 
using Result = std::vector<std::string>
 

Public Member Functions

void resolve (const std::string &, Family=Inet)
 
void setTimeout (int)
 
AsyncFw::CoroutineAwait coResolve (const std::string &, Family=Inet)
 The AddressInfo::coResolve coroutine awaiter.
 

Public Attributes

FunctionConnectorProtected< AddressInfo >::Connector< int, const std::vector< std::string > & > completed
 The AddressInfo::completed connector.
 

Detailed Description

The AddressInfo class.

Examlpe with FunctionConnector:

AsyncFw::AddressInfo addressInfo;
addressInfo.completed([](int, const std::vector<std::string> &list) {
if (!list.empty()) {
logError("Resolve error");
} else {
for (const std::string _s : list) logNotice() << _s;
}
});
addressInfo.resolve("github.com");

Examlpe with CoroutineAwait:

AsyncFw::AddressInfo addressInfo;
AsyncFw::CoroutineHandle h = co_await addressInfo.coResolve("github.com");
AsyncFw::AddressInfo::Result list = h.promise().data<AsyncFw::AddressInfo::Result>();
if (list.empty()) {
logError("Resolve error");
co_return;
}
for (const std::string _s : list) logNotice() << _s;

The documentation for this class was generated from the following files: