executor_type get_executor() noexcept;
Returns: The associated executor.
void cancel();
Effects: Cancels all outstanding asynchronous resolve operations associated with *this. Completion handlers for canceled operations are passed an error code ec such that ec == errc::operation_canceled yields true.
Remarks: Does not block (C++ 2014 [defns.block]) the calling thread pending completion of the canceled operations.
results_type resolve(string_view host_name, string_view service_name);
results_type resolve(string_view host_name, string_view service_name,
error_code& ec);
Returns: resolve(host_name, service_name, resolver_base::flags(), ec).
results_type resolve(string_view host_name, string_view service_name,
flags f);
results_type resolve(string_view host_name, string_view service_name,
flags f, error_code& ec);
Effects: If host_name.data() != nullptr, let H be an ntbs constructed from host_name; otherwise, let H be nullptr. If service_name.data() != nullptr, let S be an ntbs constructed from service_name; otherwise, let S be nullptr. Resolves a host name and service name, as if by POSIX:
addrinfo hints; hints.ai_flags = static_cast<int>(f); hints.ai_family = AF_UNSPEC; hints.ai_socktype = endpoint_type().protocol().type(); hints.ai_protocol = endpoint_type().protocol().protocol(); hints.ai_addr = nullptr; hints.ai_addrlen = 0; hints.ai_canonname = nullptr; hints.ai_next = nullptr; addrinfo* result = nullptr; getaddrinfo(H, S, &hints, &result);
Returns: On success, a non-empty results object containing the results of the resolve operation. Otherwise results_type().
template<class CompletionToken>
DEDUCED async_resolve(string_view host_name, string_view service_name,
CompletionToken&& token);
Returns:
async_resolve(host_name, service_name, resolver_base::flags(), forward<CompletionToken>(token))
template<class CompletionToken>
DEDUCED async_resolve(string_view host_name, string_view service_name,
flags f, CompletionToken&& token);
Completion signature: void(error_code ec, results_type r).
Effects: If host_name.data() != nullptr, let H be an ntbs constructed from host_name; otherwise, let H be nullptr. If service_name.data() != nullptr, let S be an ntbs constructed from service_name; otherwise, let S be nullptr. Initiates an asynchronous operation to resolve a host name and service name, as if by POSIX:
addrinfo hints; hints.ai_flags = static_cast<int>(f); hints.ai_family = AF_UNSPEC; hints.ai_socktype = endpoint_type().protocol().type(); hints.ai_protocol = endpoint_type().protocol().protocol(); hints.ai_addr = nullptr; hints.ai_addrlen = 0; hints.ai_canonname = nullptr; hints.ai_next = nullptr; addrinfo* result = nullptr; getaddrinfo(H, S, &hints, &result);
On success, r is a non-empty results object containing the results of the resolve operation. Otherwise, r is results_type().
results_type resolve(const protocol_type& protocol,
string_view host_name, string_view service_name);
results_type resolve(const protocol_type& protocol,
string_view host_name, string_view service_name,
error_code& ec);
Returns: resolve(protocol, host_name, service_name, resolver_base::flags(), ec).
results_type resolve(const protocol_type& protocol,
string_view host_name, string_view service_name,
flags f);
results_type resolve(const protocol_type& protocol,
string_view host_name, string_view service_name,
flags f, error_code& ec);
Effects: If host_name.data() != nullptr, let H be an ntbs constructed from host_name; otherwise, let H be nullptr. If service_name.data() != nullptr, let S be an ntbs constructed from service_name; otherwise, let S be nullptr. Resolves a host name and service name, as if by POSIX:
addrinfo hints; hints.ai_flags = static_cast<int>(f); hints.ai_family = protocol.family(); hints.ai_socktype = protocol.type(); hints.ai_protocol = protocol.protocol(); hints.ai_addr = nullptr; hints.ai_addrlen = 0; hints.ai_canonname = nullptr; hints.ai_next = nullptr; addrinfo* result = nullptr; getaddrinfo(H, S, &hints, &result);
Returns: On success, a non-empty results object containing the results of the resolve operation. Otherwise results_type().
template<class CompletionToken>
DEDUCED async_resolve(const protocol_type& protocol,
string_view host_name, string_view service_name,
CompletionToken&& token);
Returns:
async_resolve(protocol, host_name, service_name, resolver_base::flags(), forward<CompletionToken>(token))
template<class CompletionToken>
DEDUCED async_resolve(const protocol& protocol,
string_view host_name, string_view service_name,
flags f, CompletionToken&& token);
Completion signature: void(error_code ec, results_type r).
Effects: If host_name.data() != nullptr, let H be an ntbs constructed from host_name; otherwise, let H be nullptr. If service_name.data() != nullptr, let S be an ntbs constructed from service_name; otherwise, let S be nullptr. Initiates an asynchronous operation to resolve a host name and service name, as if by POSIX:
addrinfo hints; hints.ai_flags = static_cast<int>(f); hints.ai_family = protocol.family(); hints.ai_socktype = protocol.type(); hints.ai_protocol = protocol.protocol(); hints.ai_addr = nullptr; hints.ai_addrlen = 0; hints.ai_canonname = nullptr; hints.ai_next = nullptr; addrinfo* result = nullptr; getaddrinfo(H, S, &hints, &result);
On success, r is a non-empty results object containing the results of the resolve operation. Otherwise, r is results_type().
results_type resolve(const endpoint_type& e);
results_type resolve(const endpoint_type& e, error_code& ec);
Effects: Let S1 and S2 be implementation-defined values that are sufficiently large to hold the host name and service name respectively. Resolves an endpoint as if by POSIX:
char host_name[S1]; char service_name[S2]; int flags = 0; if (endpoint_type().protocol().type() == SOCK_DGRAM) flags |= NI_DGRAM; int result = getnameinfo((const sockaddr*)e.data(), e.size(), host_name, S1, service_name, S2, flags); if (result != 0){ flags |= NI_NUMERICSERV; result = getnameinfo((const sockaddr*)e.data(), e.size(), host_name, S1, service_name, S2, flags); }
Returns: On success, a results object with size() == 1 containing the results of the resolve operation. Otherwise results_type().
template<class CompletionToken>
DEDUCED async_resolve(const endpoint_type& e,
CompletionToken&& token);
Completion signature: void(error_code ec, results_type r).
Effects: Let S1 and S2 be implementation-defined values that are sufficiently large to hold the host name and service name respectively. Initiates an asynchronous operation to resolve an endpoint as if by POSIX:
char host_name[S1]; char service_name[S2]; int flags = 0; if (endpoint_type().protocol().type() == SOCK_DGRAM) flags |= NI_DGRAM; int result = getnameinfo((const sockaddr*)e.data(), e.size(), host_name, S1, service_name, S2, flags); if (result != 0){ flags |= NI_NUMERICSERV; result = getnameinfo((const sockaddr*)e.data(), e.size(), host_name, S1, service_name, S2, flags); }
On success, r is a results object with size() == 1 containing the results of the resolve operation; otherwise, r is results_type().