By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,232 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

Internet Accessible?

P: n/a
Hi all
How can I find that user is connected to internet or not?

thanks in advance
Sep 23 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hello perspolis,

Google first
http://groups.google.com/groups/sear...check+internet, as well as
http://www.codeguru.com/Cpp/I-N/inte...icle.php/c3437
sample

pHi all
pHow can I find that user is connected to internet or not?
pthanks in advance
p>
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Sep 23 '06 #2

P: n/a
Is there an equivalent to InternetCheckConnection in .Net? If not, why not
interop it?

Here's another alternative:

using System.Net;

HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(@"http://www.microsoft.com");
An exception indicates that the site isn't reachable thus probably there is
no internet connection (ms site could be down as well, but that is not as
probable).
--
Regards, Peter

"Michael Nemtsev" <ne*****@msn.comskrev i meddelandet
news:17***************************@msnews.microsof t.com...
Hello perspolis,

Google first
http://groups.google.com/groups/sear...check+internet, as well as
http://www.codeguru.com/Cpp/I-N/inte...icle.php/c3437
sample
pHi all
pHow can I find that user is connected to internet or not?
pthanks in advance
p---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche



Sep 23 '06 #3

P: n/a
This is the check for network connectivity (in .NET 2.0):

System.Net.NetworkInformation.NetworkInterface.Get IsNetworkAvailable();

This will tell you only if you are connected to something (network, dialup,
wireless etc), not whether the internet is contactable. The best bet is to
try and do what you want to do and handle any exceptions, or try and open
something like google for microsoft to check for connectivity.

HTH

Ciaran O'Donnell

"Peter Thornqvist" wrote:
Is there an equivalent to InternetCheckConnection in .Net? If not, why not
interop it?

Here's another alternative:

using System.Net;

HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(@"http://www.microsoft.com");
An exception indicates that the site isn't reachable thus probably there is
no internet connection (ms site could be down as well, but that is not as
probable).
--
Regards, Peter

"Michael Nemtsev" <ne*****@msn.comskrev i meddelandet
news:17***************************@msnews.microsof t.com...
Hello perspolis,

Google first
http://groups.google.com/groups/sear...check+internet, as well as
http://www.codeguru.com/Cpp/I-N/inte...icle.php/c3437
sample
pHi all
pHow can I find that user is connected to internet or not?
pthanks in advance
p---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche



Sep 25 '06 #4

P: n/a
You can also handle events with network availability at
System.Net.NetworkInformation.NetworkChange.Networ kAvailabilityChanged
and you can ping webserver to check for connectivity too.
System.Net.NetworkInformation.Ping

HTH

Ciaran O'Donnell
"perspolis" wrote:
Hi all
How can I find that user is connected to internet or not?

thanks in advance
Sep 25 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.