🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #15877

Re: howto detect internet connection?

#15877
From: Alvise Valsecchi
Date: Wed, 11 Jun 2003 13:38
35 lines
2597 bytes
Claudiu Balciza wrote:

> I need to detect when the local system has connected to the internet mainly
> by modem.
> any suggestions?

Hi Claudiu. Once I had the same problem and I solved it this way:

By the time the application program needs the PC to be connected to the 
Internet, it must send a MessageBox to the user with the following message:

"Connect the PC to your ISP and press OK when ready" (or a similar 
message). The MessageBox has two buttons: OK and Esc.

Then the application gives the user the time to turn on the modem, 
launch "remote access" and connect to the ISP. If the user will press OK 
then the application program can go on, if he will press Esc, the 
program will rollback the requested function.

You can say this is an idiot way of proceeding, but I can guarantee that 
it works fine, and is a good workaround to your problem. Differently you 
should do one of the following:

- use some InternetExplorer API (I can't remember the name, something 
like "CheckInternetConnection" or so) that might not be installed into 
the end user computer (it's a DLL that comes with InternetExplorer)

- try to open a socket to an external IP (say Yahoo), but if the PC is 
not connected to the Internet the user will wait 2 minutes before the 
socket goes in time-out

After a short investigation you will agree that the simple idiot 
solution proposed above is the most effective.

Regards. Alvise.
Technical Details
Message-ID: <3ee73194$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.news2me.com!elnk-pas-nf2!newsfeed.earthlink.net!news.astraweb.com!news-small.astraweb.com!newspeer1.nwr.nac.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3ee7105b$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,e5344293a067ae40
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-06-11 06:53:00 PST
Date: Wed, 11 Jun 2003 15:38:28 +0200
From: Alvise Valsecchi <alvise@hochfeiler.it>
User-Agent: Mozilla/5.0 (Windows; U; Win95; en-US; rv:1.3.1) Gecko/20030425
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: howto detect internet connection?
References: <3ee7105b$1@newsgroups.borland.com>
In-Reply-To: <3ee7105b$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 195.110.148.66
Message-ID: <3ee73194$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1055338900 195.110.148.66 (11 Jun 2003 06:41:40 -0700)
Lines: 38
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.news2me.com!elnk-pas-nf2!newsfeed.earthlink.net!news.astraweb.com!news-small.astraweb.com!newspeer1.nwr.nac.net!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail