curl / Mailing Lists / curl-library / Single Mail

curl-library

Couple cuestions about CURLOPT_WRITEFUNCTION callback

From: David Requena <drequena_at_gmail.com>
Date: Mon, 13 Feb 2017 13:50:19 +0100

Hi all,

I'm having a hard time understanding size_t size, size_t nmemb parameters
of this callback.

I understand actual data size is size * nmemb but why have it decomposed
like this? IOW: what are size and nmemb meant to convey themselves?

On the other hand I'm looking into this in order to implement an SSE
(Server Sent Events) client.
The spec is at https://www.w3.org/TR/eventsource/. Basically the server
keeps the connection open and keeps sending small text chunks (events)
separated by double newlines to the client

CURLOPT_WRITEFUNCTION's documentation does explain very little about data
buffering, just stating default max data size is 16K. I'm afraid libcurl
might keep buffering events and only deliver them to my write callback in a
big batch. That of course would negate the whole SSE idea.

Is there a way I could control when CURLOPT_WRITEFUNCTION is actually
called? Being a binary thing I don't suppose received linefeed have any
effect on this..

Thanks in advance!

-- 
Saludos / Regards,
David Requena

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