简体   繁体   English

GetHostAddress()不返回任何IPv6,仅返回IPv4

[英]GetHostAddress() returns no IPv6, only IPv4

When using Dns.GetHostAddresses("fred") it returns only IPv4 addresses in response. 使用Dns.GetHostAddresses(“ fred”)时,它仅返回IPv4地址作为响应。 How to get the IPv6 addresses as well? 如何获得IPv6地址? Is there different method I shall use? 我应该使用其他方法吗?

Socket.OSSupportsIPv6 returns true and IPv6 connections work fine. Socket.OSSupportsIPv6返回true,IPv6连接正常。 The OS is Windows 2008 R2, .Net version is 3.5. 操作系统为Windows 2008 R2,.Net版本为3.5。

IPv6 still uses DNS to resolve addresses so in order for this to work you will need to add an IPv6 entry to your zone file for this domain name. IPv6仍使用DNS来解析地址,因此,要使其正常工作,您将需要在该域名的区域文件中添加IPv6条目。 It'll then resolve properly. 然后它将正确解决。

I suspect that Ping will fall back to IPv4 if an IPv6 is not available, not exactly what you'd hope once you've specified the '-6' flag. 我怀疑如果IPv6不可用,Ping将回落到IPv4,这与您指定'-6'标志后所希望的不完全一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM