getaddrinfo() 仅返回 ::1 作为 IPV6 地址,
我使用 getaddrinfo() 返回所有分配的 IP 地址(IPv4 和 IPv6)适用于我的本地计算机。我看到在 XP 上, getaddrinfo() 只返回 ::1
(我在 2 XP 机器上安装了 IPV6 堆栈并配置了 IPV6 地址并对两个对等点执行 ping 操作。它们工作正常。我检查了 Ipconfig,一切正常。 )
I'm using getaddrinfo() 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.
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我相信贡萨洛走在正确的道路上。据我了解, ::1 是 localhost 的简写。 。 。几乎在每种情况下,当迭代返回的列表时,IPV6 localhost ::1 首先显示。 。 。
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 . . .
好吧,在
::1
地址中(或者更确切地说,在任何有双冒号的地址中),双冒号扩展到零位的数量,需要将地址填充到完整长度,因此扩展版本看起来像0000:0000:0000:0000:0000:0000:0000:0001
。在 ipv6 中,这是唯一的地址,专门定义为环回地址(与 ipv4 不同,您可以在 ipv4 中获取
127.0.0.0/8
来实现这些目的)。(您确定您实际上是在迭代结果,而不仅仅是检查链表的第一个元素吗?)
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 like0000: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?)
我建议不要使用 Windows XP 和 2003 上的双堆栈配置。这些堆栈彼此之间不能很好地配合。如果您需要 IPv6,请使用 Windows 2008 R2 或 Windows 7。
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.