Dns.GetHostEntry is not giving me a good IP to pass to IPEndPoint function in my domain

Posted by Beach Miles on Super User See other posts from Super User or by Beach Miles
Published on 2014-08-21T23:27:53Z Indexed on 2014/08/22 4:23 UTC
Read the original article Hit count: 131

Filed under:
|
|
|
|

My c# code from my asynchronous socket client to get the address of my socket server.

string testServerIP = "192.168.0.1";
IPHostEntry ipHostInfo = Dns.GetHostEntry(testServerIP); //time server address
IPAddress ipAddress = ipHostInfo.AddressList[0];             
IPEndPoint remoteEP = new IPEndPoint(ipAddress, port);

I get the following error message from the above code.

CheckServerReconnect:Cant connect to 192.168.0.1 The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for

© Super User or respective owner

Related posts about networking

Related posts about dns