Ticket #14323: gai.c
File gai.c, 352 bytes (added by , 6 years ago) |
---|
Line | |
---|---|
1 | #include <netdb.h> |
2 | #include <stddef.h> |
3 | #include <stdio.h> |
4 | #include <sys/socket.h> |
5 | |
6 | int main() { |
7 | struct addrinfo* res; |
8 | struct addrinfo hints = { 0 }; |
9 | hints.ai_family = AF_INET6; |
10 | hints.ai_flags = AI_V4MAPPED; |
11 | int err = getaddrinfo("localhost", NULL, &hints, &res); |
12 | if (err != 0) { |
13 | puts(gai_strerror(err)); |
14 | return 1; |
15 | } |
16 | return 0; |
17 | } |