Question

how is it possible to get an ipv6 address from a addrinfo struct under windows xp? is there any other possibility than WSAAddressToString (has anyone ever successfully used that one?) ?

getaddrinfo(server_ip, port, &hints, &result)
addr = (struct sockaddr_in6*) rp->ai_addr;
WSAAddressToString((struct sockaddr*) rp, (DWORD) sizeof(*addr), 0, ipbuf, &iplen); //cant get it to work

thank you very much

Était-ce utile?

La solution

Try:

WSAAddressToString(rp->ai_addr, rp->ai_addrlen, NULL, ipbuf, &iplen);

You're passing an addrinfo as a sockaddr in your example. (I assume rp is iterating over the results or something.)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top