How do I detect whether of not an Internet connection exists?

My problem is that I need to test whether or not a connection to the internet exists in windows95.  The obvious solution is to test your own IP address and compare it to .  If the comparison is true, your offline.  Any other IP address means your online.

The problem is that with windows95, any call to winsock triggers the dialer.  I DO NOT want to trigger the dialer if there is no connection to the internet.

So, I guess my question is:

   How do I make a call to Winsock without triggering the dialer?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sleachAuthor Commented:
Edited text of question
sleachAuthor Commented:
Adjusted points to 204
Might work using the RasEnumConnections API call...

If you need help using this function, let me know.



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

sleachAuthor Commented:
sperling, I am unfamiliar with RAS.  Can you point me to a code example?  

Also, will RasEnumConnections show only dial up networking connections, or will it also show connections from other dialers(such as AOL's 32 bit dialer)?

I am currently using FindWindow to detect the Win95 Dialer, but this only works with the Win95 Dialer.  I need a method thats Dialer independant.

Can RAS be used to disable the AutoDial feature?
>sperling, I am unfamiliar with RAS. Can you point me to a code

So am I ;)

I haven't got any modems installed, and I don't run 95... Therefore I can just suggest that you make a small test program displaying RasEnumConnections output in an ButtonClick event, and then tries to figure out how it works by noting what output you get while offline and online using different dialers.

Sorry I can't be of more help.


sleachAuthor Commented:
It took me awhile, but I finally figured it out.

For the purpose of sharing the solution, Here is the function that works for me.

USES ras;

function RasConnected:  boolean;
    rasconnbuf:  TRasConn;
    cb, ret, numConn:  integer;
    connected:  boolean;

    //Required to provide buffer size
    rasconnbuf.dwSize := sizeof(rasconnbuf);
    cb := sizeof(TRasConn);

    //Retrieve info about first active connection (I only have one - change this if you have more)
    ret := RasEnumConnections(@rasconnbuf, cb, numConn);

    if ((numConn = 0) or (ret <> 0)) then connected := false
    else Connected := true;
result := connected;

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.