cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Connected ?

From: Paul Johnson <paul_at_applewoodhouse.com>
Date: Mon, 14 Jul 2003 21:35:57 +0100

Ah, nice one - thanks.

Regards,
Paul Johnson
Applewood House
www.applewoodhouse.com

----- Original Message -----
From: "Andrew Francis" <locust_at_familyhealth.com.au>
To: <curl-library_at_lists.sourceforge.net>
Sent: Monday, July 14, 2003 5:22 PM
Subject: Re: Connected ?

> 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
>
> --
> Andrew Francis
> Software Developer
> Family Health Software
>
>
> -------------------------------------------------------
> 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
>
>

-------------------------------------------------------
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