I can't find any proper description in the documentation for what this actually does.
Does it check for the existence of A records or CNAME records or both?
My understanding is that in .NET 4, this throws a SocketException if the host does not exist, and this is confirmed by my testing.
This is the list of addresses returned by
And these are the A records pulled from network-tools.com, DNS query.
So I'd say it does pull A records.
Dns.GetHostEntry
is built on top of the Windows API and does not use the DNS protocol directly. If IPv6 is enabled it will callgetaddrinfo
. Otherwise it will callgethostbyaddr
. These functions may use the local%SystemRoot%\System32\drivers\etc\hosts
file, DNS or even NETBIOS to resolve a host name to an IP address. Resolving a host name to an IP address using DNS will use CNAME records to find the A record.You can test this by resolving
www.google.com
that at least right now has a CNAME record that points towww.l.google.com
. UsingDns.GetHostEntry
will return the IP addresses from the A records forwww.l.google.com
.