cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: blocking call

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 28 Jan 2006 14:03:36 +0100 (CET)

On Fri, 27 Jan 2006, Cris Putnam wrote:

> I am using the curl easy interface to automate authentication through
> firewalls.

Then consider using the curl-library list instead.

> My application was designed to be single threaded and now I am running into
> a problem, it hangs if the network goes down during login. I suppose the
> curl_easy_perform(curl)call is a blocking call, right?

Yes it is, but it features various options that allow you to timeout/cancel
slow operations.

> Is there away I can turn this blocking off so that if the network goes away,
> it will fail, and go back to my gui.

The "network goes away" is not a general TCP error. TCP was designed to work
even if the network goes away and later comes back. You need to decide on
app-level what an error condition is for your case and make sure to abort your
operation then.

Timeouts, low-speed limit and progress callback are the three most used
mechanisms to achieve this.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-01-28