curl-library
Re: check internet connection with curl
Date: Thu, 24 Apr 2008 07:48:06 +0200
well all i like to do is simple ping/echo test to see if there is
internet connection
something like "ping www.google.com" check if im getting response and
keep doing it
every N seconds .
the problem with this that i dont what to flode google with pings
and also i dont know if google decide to change there domain name to
something else
then my application will not work.
On Wed, Apr 23, 2008 at 7:55 PM, Gary Maxwell <gmaxwell_at_casabi.com> wrote:
> Dan Fandrich wrote:
> >
> > On Wed, Apr 23, 2008 at 04:36:25PM +0200, Meir Yanovich wrote:
> > > Hello all
> > > is there simple way to check internet connection with curl lib
> before
> > > starting curl curl_easy_perform ?
> >
> > Sure, start another connection to the server with another easy handle
> and
> > if that fails, your connection is down :)
> >
> Meir,
>
> Even if you perform this "simple" check, there is no guarantee (although
> the odds are very good) that the connection will succeed when you issue
> your curl_easy_perform. A lot depends on what you are checking: the
> physical connection, the hop to your router, or the complete path to the
> server. If you want to test all the way to the server by opening a TCP
> socket, and the server is down, you will still experience the same
> system-dependent delay as you would by trying a curl_easy_perform.
>
> If you would clarify what you are trying to accomplish (my guess is
> avoiding a delay when curl_easy_perform fails to connect), we could
> offer better suggestions.
>
> -Gary
>
Received on 2008-04-24