cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl don't write data directly (internal buffering?)

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 29 Sep 2012 15:49:52 +0200 (CEST)

On Fri, 28 Sep 2012, Eric Beuque wrote:

> In fact, i add a sleep(1) in the function that process my frame. I also
> develop a server application that generate an MJPEG stream (but i got the
> same problem directly from an ip camera).

Sorry, but I don't quite understand where you added the sleep() and what that
proved! Also, you haven't shown us how your libcurl using code looks like so I
can't exclude that there's a problem with it.

Internally in libcurl when it finds that the socket is readable, it will read
(up to 16K) and then immediately hand over the read data (after some possible
massaging of it depending on what protocol, libcurl options and in which shape
the data arrived) to the write callback.

There is no internal buffering but libcurl will then immediately use the same
buffer to again read more data from the socket as soon as it becomes readable
again and so it loops. This goes on until the transfer is completed.

CURLOPT_DEBUGFUNCTION is a great option to use to get to see exactly which
data that is received by libcurl and what data it sends and when.

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