cURL / Mailing Lists / curl-library / Single Mail


Questions about timeout during transfer

From: Saqib Ali <>
Date: Wed, 25 May 2011 02:01:10 -0400

This URL explains how to set the CURLOPT_TIMEOUT and
the CURLOPT_CONNECTTIMEOUT for the easy interface:

I'm performing transfers (using the easy interface and multi-stack) and I
would like to constrain the transfer such that if no data transfers for 1
full minute, the transfer times out. However, in the normal case, the full
transfer may take 2 or more minutes. So I cannot simply set the
CURLOPT_TIMEOUT to 60 seconds. What approach have other developers used in
this circumstance? Surely I can't be the only one to encounter this type of

The reason I'm concerned about this is that my application requires that I
check the value of a flag at least every one minute. The flag starts out
unset. But if it becomes set, I need to cancel the transfer immediately.
During a successful file transmission, I can simply check this flag after
every call to curl_multi_perform. However, if during the transmission, the
connection breaks, curl_multi_perform will not return control. So I cannot
check the flag. For this reason, I must set the CURLOPT_TIMEOUT to 60
seconds.... The only problem is that this also limits my *overall* file
transfer to 60 seconds - which I don't want.

- Saqib

List admin:
Received on 2011-05-25