GetHostAddress() returns no IPv6, only IPv4

天涯浪子 提交于 2019-12-08 04:23:49

问题


When using Dns.GetHostAddresses("fred") it returns only IPv4 addresses in response. How to get the IPv6 addresses as well? Is there different method I shall use?

Socket.OSSupportsIPv6 returns true and IPv6 connections work fine. The OS is Windows 2008 R2, .Net version is 3.5.


回答1:


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. 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.



来源:https://stackoverflow.com/questions/7431005/gethostaddress-returns-no-ipv6-only-ipv4

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!