Answers

Jul 27, 2007 - 08:46 AM
there is sample code here that may help but note one of the comments. Are you connected to Lan or Internet so suggestion is to use HttpRequest
http://www.dotnet247.com/247reference...
I guess you could also ping a website
http://www.codeproject.com/dotnet/CSh...
http://www.dotnet247.com/247reference...
I guess you could also ping a website
http://www.codeproject.com/dotnet/CSh...

Jul 28, 2007 - 03:21 AM
Thanks for the references, nidhi.
I decided to use the ping approach like this:
public bool CheckHostReachable(string host)
{
System.Net.NetworkInformation.Ping p = new Ping();
PingReply pingReply = p.Send(host, 5000);
return (pingReply.Status == IPStatus.Success);
}
I found out that there is also an asynchronous way of pinging, but since I needed the next action to be dependent on whether I had connectivity or not, I decided to use the synchronous way.
I decided to use the ping approach like this:
public bool CheckHostReachable(string host)
{
System.Net.NetworkInformation.Ping p = new Ping();
PingReply pingReply = p.Send(host, 5000);
return (pingReply.Status == IPStatus.Success);
}
I found out that there is also an asynchronous way of pinging, but since I needed the next action to be dependent on whether I had connectivity or not, I decided to use the synchronous way.

Jul 28, 2007 - 07:21 AM
Yea, I think ping would be the best, at least then it doesnt care about how internet connection is made i.e. lan or modem. Depending on how speed is an issue when checking, you might want to think about hops. Not sure if you can specify how many hops you can make though.

Dec 28, 2010 - 07:50 PM
I am bothered with the slow internet connection for quite a long time, but now I found an easy way to handle my problem, which is the software tuneup360.
Add New Comment