cURL / Mailing Lists / curl-library / Single Mail


Re: check internet connection with curl

From: Alan Wolfe <>
Date: Thu, 24 Apr 2008 12:55:12 -0700

well here's an idea, you are using curl to make some kind of http
operations to some server right?

You don't care so much that a person doesn't have internet, what you
really care about is whether or not you can reach that host right?

So what about this...

*Try to send a request to your target server, if it fails, report
connection problems to the user.

If i'm right about you're program, that's much simpler than this...

*check for internet connection and if no connection found, show an
error to the user
*make a request of the target server, and if it fails, show an error to the user

seems to me you can simplify the process by just contacting your
server but i could be misinterpreting what you are trying to do.

On 4/24/08, Meir Yanovich <> wrote:
> no problem i guess .
> you mean just to make simple http post operation ?
> what will be the lightest curl operation to do , to determine if there
> is internet connection ?
> On Thu, Apr 24, 2008 at 6:50 PM, Gary Maxwell <> wrote:
> > Meir Yanovich wrote:
> > >
> > > thanks for the explanation about pings.
> > > what about doing ping to one major site like
> > > and according to the result determine if im online or not .
> > > the reason i need this check is that the client need to preform his
> > > best guess when there is
> > > internet connection after loosing connection .
> > >
> > And performing a curl operation isn't good enough to determine if you
> > have a good connection? Why not?
> >
> > Once again, ping is unreliable for what you want. The ping may fail even
> > if your connection is fine.
> >
> > -Gary
> >
Received on 2008-04-24