Reputation: 2470
I am trying to use the following line of code :
Dim lobjPingReply As Net.NetworkInformation.PingReply =
lobjPingObject.Send(lobjMyURI.DnsSafeHost)
When my unit test hits this line and the host is invalid I get the following error "No Such host was known"
When I actually debug the code using the same paramter I get this error
"The requested name is valid, but no dataof the requested type was found"
Why should the same line with the same parameter give a different response?
Upvotes: 0
Views: 2017
Reputation: 20775
Error - WSANO_DATA
Error Code - 11004
Valid name, no data record of requested type. 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.
Error - WSAHOST_NOT_FOUND
Error Code - 11001
Host not found.
No such host is known. The name is not an official host name or alias, or it cannot be found in the database(s) being queried. This error may also be returned for protocol and service queries, and means that the specified name could not be found in the relevant database.
These two errors are overlapping each other, so you get the last error generated by the socket. So you are getting different values.
Upvotes: 2