2

I would like to read chunks of data from an http response as soon as the server flushes them, regardless of their size. Some chunks may only be 8 bytes.

Nick Retallack
  • 18,986
  • 17
  • 92
  • 114

1 Answers1

5

The --buffer/--no-buffer options are a feature of the CURL command-line app, not the LIBCURL library itself. When LIBCURL receives data from the server, it gives the data to CURL right away, and then CURL writes the data to its output stream and flushes the stream if --no-buffer is enabled.

For what you are asking, simply use curl_easy_setopt(CURLOPT_WRITEFUNCTION) to assign a callback function so LIBCURL can give you data as soon as it receives from the server. You can do whatever you want with the data.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770