cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: BUFFERSIZE on read callbacks.

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Thu, 18 Dec 2003 19:21:39 +0100 (CET)

On Thu, 18 Dec 2003, Wei Weng wrote:

> The read callback declaration is as read_callback(void* buffer, size_t size,
> size_t nmemb, void* stream). Say, the application might pass me size as
> 10000 bytes, and I have to return to it this much data when the read
> callback exits. I can not set a limit on the amount of data read_callback
> requests.

Yes, you can! The size asked for by libcurl in the read callback is the
maximum amount of data you can return, you can safely opt to return less.

In fact, that's how the command line tool implements its transfer-speed
limiter (it thus also involves a sleep before it returns control to the
library).

Or is there something I'm missing?

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
   [[ Do not send mails to this email address. They won't reach me. ]]
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
Received on 2003-12-18