🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: howto detect internet connection?

#15879
From: Nick B. Cassos
Date: Wed, 11 Jun 2003 17:15
35 lines
2231 bytes
On Wed, 11 Jun 2003 14:20:08 +0300, "Claudiu Balciza"
<claudiu.balciza@eurolex.ro> wrote:

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

A question as old as life itself and one of the most frequent. No
single function can tell if you are connected to the internet reliably
or without side-effects such as automatic connections (depending on
end-user's machine settings). The problem gets aglier if you wish to
support all Windows versions. 

I will give you a list of alternatives:

1. RasEnumConnectios()
Perhaps the most suitable in your case (dial-up access). You have to
do it the hard way (dynamic linking) should you wish to support
various OS flavours. If you have a DUN entry to search for (entered by
the user as a setting) then you will be almost foolproof.

2. InternetGetConnectedState() / InternetCheckConnection()
You need wininet for this. For some reason, Microsoft does not
encourage developers to use this library. Easy, but not very reliable.

3. IsNetworkAlive() / IsDestinationReachable()
Requires InternetExplorer 5 and something newer than Win95/98/NT. If
this does not bother you then this is the best way to go.

-- 

Nick B. Cassos
http://www.flenik.com
Technical Details
Message-ID: <cvneevce8jkcuaaehl46ortmkkdbsjmrso@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!sn-xit-09!supernews.com!news.maxwell.syr.edu!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 10:21:14 PST
From: Nick B. Cassos <nbc@no_spam.ath.forthnet.gr>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: howto detect internet connection?
Date: Wed, 11 Jun 2003 20:15:24 +0300
Message-ID: <cvneevce8jkcuaaehl46ortmkkdbsjmrso@4ax.com>
References: <3ee7105b$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 213.16.148.198
X-Trace: newsgroups.borland.com 1055351735 213.16.148.198 (11 Jun 2003 10:15:35 -0700)
Lines: 35
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail