cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Changing CURLOPT_MAX_RECV_SPEED_LARGE during a transfer

From: Joe Mason <jmason_at_rim.com>
Date: Fri, 31 Aug 2012 15:52:41 +0000

> From: curl-library [curl-library-bounces_at_cool.haxx.se] on behalf of Robert
>
> I'm trying to limit the download speed of a transfer, but only once the
> file is partly downloaded. I've done this by using the PROGRESSFUNCTION
> callback, in which I wait until (say) 10% of the file is downloaded and
> then call CURLOPT_MAX_RECV_SPEED_LARGE to set a rate limit.
>
> It appears to work, but I'd like to know whether this is reliable or
> whether it might break on another system.

Sorry, don't know about that, but if it IS reliable...

> The second thing I'd like to do is be able to change the rate limit at
> regular intervals while the transfer is in progress. The obvious way
> would be to have a second thread that calls CURLOPT_MAX_RECV_SPEED_LARGE
> at regular intervals, but I can't do that without sharing the curl
> handle between threads. Is there a way to do this?

...then you should be able to use the multi interface and select with a timeout. You can adjust CURLOPT_MAX_RECV_SPEED_LARGE whenever the timeout occurs.

Joe
---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-08-31