|
E-MailRelay
|
A 'future' object for asynchronous name resolution, in practice holding just enough state for a single call to getaddrinfo(). More...
#include <gresolverfuture.h>
Public Types | |
| typedef std::pair< Address, std::string > | Pair |
| typedef std::vector< Address > | List |
Public Member Functions | |
| ResolverFuture (const std::string &host, const std::string &service, int family, bool dgram, bool for_async_hint=false) | |
| Constructor for resolving the given host and service names. | |
| ~ResolverFuture () | |
| Destructor. | |
| void | run () |
| Does the name resolution. | |
| Pair | get () |
| Returns the resolved address/name pair. | |
| void | get (List &) |
| Returns the list of resolved addresses. | |
| bool | error () const |
| Returns true if name resolution failed or no suitable address was returned. More... | |
| std::string | reason () const |
| Returns the reason for the error(). More... | |
A 'future' object for asynchronous name resolution, in practice holding just enough state for a single call to getaddrinfo().
The run() method can be called from a worker thread and the results collected by the main thread with get() once the run() has finished.
Signalling completion from worker thread to main thread is out of scope for this class; see GNet::FutureEvent.
Eg:
Definition at line 56 of file gresolverfuture.h.
| bool GNet::ResolverFuture::error | ( | ) | const |
Returns true if name resolution failed or no suitable address was returned.
Use after get().
Definition at line 146 of file gresolverfuture.cpp.
| std::string GNet::ResolverFuture::reason | ( | ) | const |
Returns the reason for the error().
Precondition: error()
Definition at line 151 of file gresolverfuture.cpp.
1.8.9.1