Check Internet Connection 
Author Message
 Check Internet Connection

Hi coders. I am developing a application, that will run automatically on
windows startup. It is basically a chat client, but i need to find a way to
allow the program to check weather a connection to the Internet is present
before it does certian things. I have seen some api that allows you to check
the state of the modem, but I am looking for something that will work for
modem, cable modem, etc users.

I hope you understand my need for help
Thank you

Mick Walker



Thu, 06 May 2004 18:08:49 GMT  
 Check Internet Connection
I use this code:
http://www.vbworld.com/internet/tip467.html

It works with my cable connection and I expect it works with a normal modem.

Alex


Quote:
> Hi coders. I am developing a application, that will run automatically on
> windows startup. It is basically a chat client, but i need to find a way
to
> allow the program to check weather a connection to the Internet is present
> before it does certian things. I have seen some api that allows you to
check
> the state of the modem, but I am looking for something that will work for
> modem, cable modem, etc users.

> I hope you understand my need for help
> Thank you

> Mick Walker



Thu, 06 May 2004 18:28:24 GMT  
 Check Internet Connection
On Sun, 18 Nov 2001 10:08:49 -0000, "Mick Walker"

Quote:

>Hi coders. I am developing a application, that will run automatically on
>windows startup. It is basically a chat client, but i need to find a way to
>allow the program to check weather a connection to the Internet is present
>before it does certian things. I have seen some api that allows you to check
>the state of the modem, but I am looking for something that will work for
>modem, cable modem, etc users.

This is a frequently asked question, and one that has a number of
"sort of" type of answers. The only way to know for sure if they can
connect to the server is to actually attempt the connection;
everything else is some degree of guesswork (for example, telling the
difference between then not having a physical network connection, or
something like a pulled cable or a down router). That said, I would do
something like the following:

1. Check to see if they have any dial-up networking connectoids
defined. If they do, you can be fairly certain they have a dial-up
connection. This isn't guaranteed to be the case (for example, it
could be a special dialup to a corporate network), but in most cases
it would be a good guess.

2. If they do have one or more connectoids, then check to see if there
is a current, active dial-up networking session using the RAS API. If
there is, then make note of it, and which one they're using.

3. Attempt to send an ICMP echo datagram to the remote host; if you
get a response, then they're up on the net. If you don't, then one of
three things could be the case (a) they're using a dial-up and aren't
connected; check the information in step 2; (b) they're not using a
dial-up and the interface or router is down; (c) the remote host does
not respond to ICMP ECHO datagrams. If the situation is (a), then
prompt them to establish a connection and try again; if it is (b)
there's not much you can do, and (c) is a situation in which this
would never work.

4. Finally, make the connection attempt with a reasonable timeout
period.

As you can see, steps 1 through 3 can give you some flexibility in
determing what kind of connection exists, but not what isn't there. In
all cases, you may just have to "punt" and make the connection attempt
directly. As far as the coding for this goes, you could either use the
RAS and Windows Sockets API directly, a control or a set of components
like our commercial SocketTools product that includes ICMP and RAS
controls.

David

----

Catalyst Development Corporation   | application with ActivePatch. Download
http://www.catalyst.com/           | the SDK from www.activepatch.com



Sun, 16 May 2004 10:28:28 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. checking internet connection from .net

2. Check Internet Connection

3. Checking Internet Connection or URL existance

4. Checking internet connection and Scripting

5. Check internet connection

6. Checking Internet connection

7. Checking for client internet connection.

8. Advanced: CHECK for Internet Connection

9. Checking an Internet Connection

10. Checking for active internet connection.

11. Check for internet connection

12. Checking an Internet Connection

 

 
Powered by phpBB® Forum Software