curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Couple cuestions about CURLOPT_WRITEFUNCTION callback

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 13 Feb 2017 15:42:00 +0100 (CET)

On Mon, 13 Feb 2017, David Requena wrote:

>> This callback function gets called by libcurl as soon as there is data
>> received that needs to be saved
>
> But it also says
>
> The callback function will be passed as much data as possible in all
> invokes, but you must not make any assumptions. It may be one
> byte, it may be thousands.

Yes. Is there a contradiction there you think? The first is comment about how
soon it'll tell you, the second is how many times you can be expected to be
told.

>> I think that implies the data is delivered fairly soon after getting
>> received and not a lot of extra buffering.
>
> I would expect but nothing indicates that's actually the case :-(

I don't understand. Can you elaborate?

> There is no hint about what the triggering conditions for the callback
> invocation might be (some timeout with no received data, whole chunk
> received, buffer 90% full, all of the former?, some of them?)

"as soon as possible"

> At this point I'm at a loss. I'll be receiving some small data item every
> couple seconds and cannot see how I'll be processing them in a timely
> manner.

Why not? To me it seems like you're trying very hard to invent a set of
problems that I don't think libcurl creates for you.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-02-13