Link to home
Start Free TrialLog in
Avatar of vjayaprasen
vjayaprasen

asked on

checking internet connection

hi guys,
 i need to check whether the internet connection is available or not.i tried RAS APi and some method.but none of them are not reliable.
is there any alternative method for that one...
thx in advance
regards
prakash
ASKER CERTIFIED SOLUTION
Avatar of jhance
jhance

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of martynjpearson
martynjpearson

You might want to check out the API functions InternetGetConnectedState() or InternetCheckConnection(). See
http://msdn.microsoft.com/library/en-us/wininet/wininet/internetgetconnectedstate.asp
and
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/internetcheckconnection.asp

Hope this helps
Martyn
Martyn,

You may want to study what these APIs actually do before recommending them in a situation like this...
I have to admit my suggestion about using InternetGetConnectedState() was based on some research I did onto the problem when wishing to do something similar in one of my own applications, rather than actual experience. I've had a hunt and found the document I found when looking into the problem before :

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q242/5/58.ASP&NoWebContent=1

It describes the use of the function, however, the article does say exactly what you said above - the only way to be sure there is a connection is to try and use it.

Best regards
Martyn