1 #include "stg/sgcp_utils.h"
4 #include <sys/socket.h>
7 std::vector<in_addr> STG::SGCP::resolve(const std::string& address)
9 addrinfo* result = NULL;
12 memset(&hints, 0, sizeof(hints));
14 hints.ai_family = AF_INET; /* Allow IPv4 */
15 hints.ai_socktype = 0; /* Datagram socket */
16 hints.ai_flags = 0; /* For wildcard IP address */
17 hints.ai_protocol = 0; /* Any protocol */
18 hints.ai_canonname = NULL;
22 int res = getaddrinfo(address.c_str(), NULL, &hints, &result);
24 throw TransportProto::Error(gai_error(res));
27 for (const addrinfo* p = result; p != NULL; p = p->next)
28 as.push_back(p->ai_addr.sin_addr);