cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Connected ?

From: Michael Roberts <michael_at_vivtek.com>
Date: Mon, 14 Jul 2003 13:23:19 -0500

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

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

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