开发者

getaddrinfo() returning only ::1 as IPV6 address,

I'm using getaddrinfo()开发者_如何学C to return all assigned IP addresses (both IPv4 and IPv6) for my local machine. I see that on XP, getaddrinfo() only returns ::1

( I installed the IPV6 stack on 2 XP machine and configured the IPV6 address and pinged the both peers. they are working fine. I check the Ipconfig its all working fine. )


I believe that Gonzalo is on the right track. ::1 is a shorthand for localhost from what I understand . . . In just about every case the IPV6 localhost ::1 shows up first when iterating through the returned list . . .


Well, in the ::1 address (or, rather, in any address, that has a double colon in it) double colon expands into the number of zero-bits, neccessary to pad the address to full length, so the expanded version looks like 0000:0000:0000:0000:0000:0000:0000:0001.

In ipv6 this is the only address, that is specifically defined as a loopback address (unlike ipv4, where you get 127.0.0.0/8 for those purposes).

(Are you sure, that you are actually iterating over the result and not just checking the first element of the linked list?)


I'd advise to stay away from the dual stack configurations on Windows XP and 2003. The stacks just don't play nice with each other. If you want IPv6 use Windows 2008 R2 or Windows 7.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜