什么是Dns.GetHostEntry方法(String)实际上做? [英] What does Dns.GetHostEntry Method(String) actually do?
本文介绍了什么是Dns.GetHostEntry方法(String)实际上做?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我找不到这是什么实际执行文件中的任何适当的说明。
I can't find any proper description in the documentation for what this actually does.
不会检查的记录或CNAME记录或两者的存在?
Does it check for the existence of A records or CNAME records or both?
我的理解是,在.NET 4中,这将引发SocketException异常,如果主机不存在了,这是我的测试证实。
My understanding is that in .NET 4, this throws a SocketException if the host does not exist, and this is confirmed by my testing.
推荐答案
这是
var ips = System.Net.Dns.GetHostEntry("microsoft.com").AddressList;
foreach (var ip in ips)
Console.WriteLine(ip);
// output
64.4.11.37
65.55.58.201
而这些都来自network-tools.com拉A记录,DNS查询。
And these are the A records pulled from network-tools.com, DNS query.
Answer records
microsoft.com A 64.4.11.37
microsoft.com A 65.55.58.201
所以,我会说这不拉记录。
So I'd say it does pull A records.
这篇关于什么是Dns.GetHostEntry方法(String)实际上做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文