Can Dns.GetHostEntry ever return an IPHostEntry with an empty AddressList?

前端 未结 4 1482
予麋鹿
予麋鹿 2021-01-15 10:57

I\'m just wondering if there can be a case where the hostname can be successfully resolved but the returned hostEntry.AddressList is empty.

Currently I\'m doing some

4条回答
  •  梦毁少年i
    2021-01-15 11:53

    Just for the records.

    Thanks to mdb's accepted answer I took a look at the description of the WSANO_DATA error:

    The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for. The usual example for this is a host name-to-address translation attempt (using gethostbyname or WSAAsyncGetHostByName) which uses the DNS (Domain Name Server). An MX record is returned but no A record—indicating the host itself exists, but is not directly reachable.

    So this pretty much answers my question :)

提交回复
热议问题