Howto know if a computer has a Internet connection ?

Hello,

How can I tell if a computer has an active Internet connection.  Regardless if it is connected with a RAS or a LAN connection.

This I have tried but it is not satisfactory

1) Using ICMP PING to see if it gets through. - Can lock the computer during certain conditions.
2) Using winet control to retrieve an URL.:  - Wininet is really unstable and crashes to often if there is no connection.
3) Using wininet.dll API’s. - Works fine if you have Internet Explorer 4-5 installed. I can not presume the users have that.

Can this be solved ? Is there any activex or dll out there implementing the ”InternetGetConnectedState” as implemented in the latest wininet.dll that I can use. Any other ideas ???

Regards
Karl
svedenborgAsked:
Who is Participating?
 
bshuler072699Connect With a Mentor Commented:
Karl Peterson has a project to show you how to do that. http://www.mvps.com/vb
0
 
KDivadCommented:
You can use the MSComm control to try and open the port the modem will be on. If you get the error 8002 (might be 8005), then the port is already open. While this won't insure that the connection is a net connection, it will know that the port has been opened for a connection.
0
 
KDivadCommented:
Just found it, 8002 is the error for no port and 8005 is the error for port already open.
0
 
svedenborgAuthor Commented:
Good tip, I tried it but it is really difficult to get something that does not hang the program when the network connection disappears....
0
All Courses

From novice to tech pro — start learning today.