cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Connected ?

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Mon, 14 Jul 2003 12:09:48 -0700

On Mon, Jul 14, 2003 at 01:23:19PM -0500, Michael Roberts wrote:
> Is there a list of "ways to figure out connectedness" for various OS's? That'd
> be a pretty interesting new feature for libcurl: a system-independent way of
> determining connectivity. People ask about it often enough.
>
> Michael

There are just too many variables to try to make it work reliably in
libcurl. How about a system with a VPN connection over ISDN to a remote
LAN but gets Internet access via a dial-on-demand masquerading router
on the local LAN? You just can't figure that sort of situation out
automatically. Granted, you could design a configuration file syntax
that could capture this, but IMHO libcurl wouldn't be the place to put
an interpreter of such a file. It would be neat if someone did figure
this out, though.

>>> Dan

>
> Andrew Francis wrote:
>
> On Mon, Jul 14, 2003 at 10:37:41AM +0100, Paul Johnson wrote:
>
>
> Fair point. I'm on win32 trying to talk to a unix server across an internet
> connection. curl has initalised successfully and returned with no errors,
> but I need to make my own program stop right there if an auto-dial flag
> isn't set and theres no internet connection.
>
>
>
> Take a look at InternetGetConnectedState and InternetDial, in
> <wininet.h>. You want something along these lines:
>
> DWORD inetInfo;
> if(InternetGetConnectedState(&inetInfo, 0) == FALSE) {
> if(!weAreAllowedToConnect)
> bombout(); // not connected and not allowed to fix that
>
> if(InternetDial(0, 0, 0, &inetInfo, 0) != ERROR_SUCCESS)
> bombout(); // we tried to dial up but couldn't
> }
>
> I've pretty much paraphrased this from some source I have lying around
> but I wrote it eons ago and don't remember what all of those zeroes mean,
> so I wouldn't recommend using this blindly without going to the docs first.
>
> You want to do this _before_ initialising WinSock. (I believe
> curl_easy_init() takes care of that these days, so do this before
> hitting curl).
>
> Cheers
>
>
>
>
>

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
Received on 2003-07-14