curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: length/size of data received/written with CURLOPT_WRITEFUNCTION

From: Ray Satiro via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 28 Mar 2024 15:26:14 -0400

On 3/28/2024 2:24 PM, R C via curl-library wrote:
> How can one 'find' the total number of bytes reveived and written 
> with a callback_write function with CURLOPT_WRITEFUNCTION


Keep track of it yourself by using CURLOPT_WRITEDATA to set the user
pointer. See the CURLOPT_WRITEFUNCTION example [1]. There is also
CURLINFO_SIZE_DOWNLOAD_T [2] which is usually the same but not always,
since it's used for statistics and counts body bytes that in certain
unusual situations must be ignored and are not passed to the write callback.


[1]: https://curl.se/libcurl/c/CURLOPT_WRITEFUNCTION.html
[2]: https://curl.se/libcurl/c/CURLINFO_SIZE_DOWNLOAD_T.html


-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2024-03-28