i'm experiencing annoying problem in c# application. reason, code causing system.net.sockets.socketexception result: "no such host known." , 'connected' false.
bool connected; try { ping pinger = new ping(); pingreply reply = pinger.send("http://www.google.com", 15000); connected = reply != null && reply.status == ipstatus.success; } catch { }
the strange thing both pinging using command prompt , http requests result in success. have idea why code failing?
it's failing because it's taking http://
part of host name, rather protocol.
ping not use http protocol, uses icmp. changing code following fix issue
ping pinger = new ping(); pingreply reply = pinger.send("www.google.com", 15000);
Comments
Post a Comment