Howto know if a computer has a Internet connection ?

Posted on 1999-07-27
Medium Priority
Last Modified: 2010-04-30

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 ???

Question by:svedenborg
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 1527751
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.

Expert Comment

ID: 1527752
Just found it, 8002 is the error for no port and 8005 is the error for port already open.

Accepted Solution

bshuler072699 earned 540 total points
ID: 1527753
Karl Peterson has a project to show you how to do that. http://www.mvps.com/vb

Author Comment

ID: 1527754
Good tip, I tried it but it is really difficult to get something that does not hang the program when the network connection disappears....

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question