Dns.GetHostEntry error conditions and resolution methods

前端 未结 1 1646
轻奢々
轻奢々 2021-01-11 11:45

I have a very specific problem concerning Dns.GetHostEntry:

A service uses Dns.GetHostEntry to retrieve all IP Adresses of a host, using the name of of the host. Thi

1条回答
  •  自闭症患者
    2021-01-11 12:22

    I personally always use Dns.GetHostAddresses. It always gives me a reliable result.

    Regarding to why Dns.GetHostEntry gives you the specified error, I think it's due to the fact that DnsGetHostEntry will attempt to do a reverse DNS lookup before returning you the IP address. If reverse DNS lookup fails, it will give you "no such host is known".

    As far as I know, Dns.GetHostAddresses just returns the IP address.

    0 讨论(0)
提交回复
热议问题