RE: check internet connection with curl
Date: Wed, 23 Apr 2008 10:55:43 -0700
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
> > starting curl curl_easy_perform ?
> Sure, start another connection to the server with another easy handle
> if that fails, your connection is down :)
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.
Received on 2008-04-23