48 struct addrinfo hints;
49 struct addrinfo *res = NULL;
52 if (host == NULL || out_addr == NULL)
57 memset(&hints, 0,
sizeof(hints));
58 hints.ai_family = AF_INET;
59 hints.ai_socktype = SOCK_DGRAM;
61 ret = getaddrinfo(host, NULL, &hints, &res);
62 if (ret != 0 || res == NULL)
68 *out_addr = ((
struct sockaddr_in *)res->ai_addr)->sin_addr;