+ /**
+ * Get a list of addresses resolved to by the given search criteria.
+ * This can be used to perform lookups for name resolution, so this
+ * method may take some time to return. Use the ResolveTask class to
+ * resolve addresses asynchronously.
+ * \param service The service name or port number.
+ * \param host The name of the local or remote host.
+ * \param type The type of socket; either SOCK_STREAM or SOCK_DGRAM.
+ * \param family The family; can be AF_INET or AF_INET6.
+ * \param resolved The list to be filled with addresses.
+ * \return 0 on success, -1 on error.
+ */
+ static int resolve(const std::string& service,
+ const std::string& host,
+ int type,
+ int family,
+ std::vector<SocketAddress>& resolved)
+ {
+ struct addrinfo* list = resolve(service.c_str(), host.c_str(),
+ type, family,
+ AI_ADDRCONFIG | AI_V4MAPPED);
+ int result = collectAddresses(list, resolved);
+ freeaddrinfo(list);
+ return result;
+ }
+
+ /**
+ * Get a list of addresses resolved to by the given search criteria.
+ * The addresses will be suitable for accepting on a local port.
+ * \param service The service name or port number.
+ * \param type The type of socket; either SOCK_STREAM or SOCK_DGRAM.
+ * \param family The family; can be AF_INET or AF_INET6.
+ * \param resolved The list to be filled with addresses.
+ * \return 0 on success, -1 on error.
+ */
+ static int resolve(const std::string& service,
+ int type,
+ int family,
+ std::vector<SocketAddress>& resolved)
+ {
+ struct addrinfo* list = resolve(service.c_str(), 0,
+ type, family,
+ AI_PASSIVE);
+ int result = collectAddresses(list, resolved);
+ freeaddrinfo(list);
+ return result;
+ }
+
+
+private:
+
+ static struct addrinfo* resolve(const char* service,
+ const char* node,
+ int type,
+ int family,
+ int flags)