473,387 Members | 3,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Checking internet connection

Hi,

From a desktop application, i want to check if an internet connection exist.
Many articles use the win api "InternetGetConnectedState", but it is no sure
thing.
I can check it by calling a site an wait for an exception but it will cost
me time (till the exception will occure)

By using .NET object and methods, how can i check it?

Thanks
Mar 22 '06 #1
4 5915
HI,

"Goldwind" <Go******@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.com...
Hi,

From a desktop application, i want to check if an internet connection
exist.
Many articles use the win api "InternetGetConnectedState", but it is no
sure
thing.
I can check it by calling a site an wait for an exception but it will cost
me time (till the exception will occure)

By using .NET object and methods, how can i check it?


You can't , first what you understand with "having connection to the
internet" , it means different things depending of how the access is done.
For example here in my office I can't use any application that does not work
with a proxy, I cannot connect directly to the internet.

The only reliable way to know if you can do "what you need to access" is
trying it and checking for exception/timeout , etc.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Mar 22 '06 #2
Hello Goldwind,

It's a bit ambiguous to check if there is an internet connection or not,
except pinging some server.
All internet resources are like intranet one, it could be or could not be
online sometimes.

What you can be really sure it's if network connection exists.

G> From a desktop application, i want to check if an internet connection
G> exist.
G> Many articles use the win api "InternetGetConnectedState", but it is
G> no sure
G> thing.
G> I can check it by calling a site an wait for an exception but it will
G> cost
G> me time (till the exception will occure)
G> By using .NET object and methods, how can i check it?
G>
G> Thanks
G>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Mar 22 '06 #3
Thanks, I guess you both are right.

What will be the best way to check for network connection?
"Michael Nemtsev" wrote:
Hello Goldwind,

It's a bit ambiguous to check if there is an internet connection or not,
except pinging some server.
All internet resources are like intranet one, it could be or could not be
online sometimes.

What you can be really sure it's if network connection exists.

G> From a desktop application, i want to check if an internet connection
G> exist.
G> Many articles use the win api "InternetGetConnectedState", but it is
G> no sure
G> thing.
G> I can check it by calling a site an wait for an exception but it will
G> cost
G> me time (till the exception will occure)
G> By using .NET object and methods, how can i check it?
G>
G> Thanks
G>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

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

Mar 23 '06 #4
Hi,

"Goldwind" <Go******@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
Thanks, I guess you both are right.

What will be the best way to check for network connection?


The very same applies. Just try to do what you need to do, and be prepared
to catch an exception or check for errors, if you do get something of the
above, then you have a problem.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Mar 23 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Mickel Grönroos | last post by:
Hi all, I have a silly question. Is there are simple way to check if the computer is connected to the Internet? It seems this should be a pretty straight-forward thing to do, but as I am totally...
0
by: Stephen | last post by:
I am developing a VB .Net application that accesses a web service to upload information to the company. This is all working but I have now been asked to get the program to make a connection to the...
4
by: Peter Flynn | last post by:
I'm having trouble finding example code to detect the presence of an Internet connection. It doesn't seem to be a very frequently asked question, as all I need is the answer yes or no (is the user...
3
by: Jonny | last post by:
Hi, Please could you tell me how to check for an internet connection in C. I'm using Windows 2000. Many Thanks, Jonny
2
by: Flashster | last post by:
This check seems to be 'true' even when I'm not connected to the internet. My network card is disabled also. Could someone tell me what I'm doing wrong? -- Declare Function...
8
by: Nikola Bucic | last post by:
Could someone tell me how can I constantly check if I'm connected to internet and if possible to determine what type of connection is it. My best shot wright now is to have a timer which will...
1
by: den 2005 | last post by:
Hi everybody, How do you monitor the connection if it is still open or close for a dial up and internet RAS connection? I used both dialup and vpn RAS. The dialup is for modem connection and vpn...
16
by: lawrence k | last post by:
I've made it habit to check all returns in my code, and usually, on most projects, I'll have an error function that reports error messages to some central location. I recently worked on a project...
1
by: =?Utf-8?B?QiBTaW5naA==?= | last post by:
Hi Scenario 1) Host - XP Laptop with internet connection using Sky Broadband Wireless Router Netgear DG834GT 2) MS Virtual Server 2005 - I have deployed an XP MS Virtual Server 2005 to act...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.