IPHostEntry remoteHostEntry = Dns.Resolve(ipAddress);

  • Thread starter Thread starter www.msmobiles.com
  • Start date Start date
W

www.msmobiles.com

IPHostEntry remoteHostEntry = Dns.Resolve(ipAddress);

... is not working on Smartphone. In other words if
ipAddress is given as host name (for example: xxxx.com )
then it works, but if I give numeric address (for
example: 123.232.23.2) then it is not working.

How to solve this problem?
 
Dns.Resolve will attempt to do reverse lookup on the dotted IP address. If
that fails (through the lack of access to DNS server or because the IP
address does not have a valid PTR record), it will throw an exception. I
suspect that what you are really looking for is an instance of IPEndPoint
object. In this case you can first try using IPAddress.Parse inside a
try/catch handler first. If that fails, use the Dns.Resolve
 
Back
Top