lis bien la doc:
ai_addr
A pointer to a sockaddr structure. The ai_addr member in each returned addrinfo structure points to a filled-in socket address structure. The length, in bytes, of each returned addrinfo structure is specified in the ai_addrlen member
ai_addr est lui même un pointeur sur une struct sockaddr.
Pour récupérer l'IP, je verrais quelque chose comme ça:
inet_ntoa(infos->ai_addr->sa_data)
ou
Après je peux rien dire vu que je suis pas sous windows. Par contre il y a un exemple dans la doc pour récupérer l'IP d'un serveur:
1 2 3 4 5 6 7
| // Declare variables
hostent* Host;
char* IP;
// Get the local host information
Host = gethostbyname("www.developpez.net");
IP = inet_ntoa (*(struct in_addr *)*Host->h_addr_list); |
Partager