- struct addrinfo hint, *res = NULL;
-
- memset(&hint, '\0', sizeof hint);
- hint.ai_family = PF_UNSPEC;
- hint.ai_flags = AI_NUMERICHOST;
+ struct addrinfo *res = NULL;
+ struct addrinfo ai_hints = {.ai_family = AF_UNSPEC,
+ .ai_flags = AI_NUMERICHOST,
+ .ai_protocol = IPPROTO_UDP,
+ .ai_socktype = SOCK_DGRAM};