1CURLOPT_BUFFERSIZE(3)      curl_easy_setopt options      CURLOPT_BUFFERSIZE(3)
2
3
4

NAME

6       CURLOPT_BUFFERSIZE - set preferred receive buffer size
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_BUFFERSIZE, long size);
12

DESCRIPTION

14       Pass  a  long specifying your preferred size (in bytes) for the receive
15       buffer in libcurl.  The main point of this  would  be  that  the  write
16       callback  gets called more often and with smaller chunks. Secondly, for
17       some protocols, there's a benefit of having a larger buffer for perfor‐
18       mance.
19
20       This  is just treated as a request, not an order. You cannot be guaran‐
21       teed to actually get the given size.
22
23       This buffer size is by default CURL_MAX_WRITE_SIZE (16kB). The  maximum
24       buffer  size allowed to be set is CURL_MAX_READ_SIZE (512kB). The mini‐
25       mum buffer size allowed to be set is 1024.
26

DEFAULT

28       CURL_MAX_WRITE_SIZE (16kB)
29

PROTOCOLS

31       All
32

EXAMPLE

34       CURL *curl = curl_easy_init();
35       if(curl) {
36         curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/foo.bin");
37
38         /* ask libcurl to allocate a larger receive buffer */
39         curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 120000L);
40
41         ret = curl_easy_perform(curl);
42
43         curl_easy_cleanup(curl);
44       }
45

AVAILABILITY

47       Added in 7.10.  Growing the buffer was added in 7.53.0.
48

RETURN VALUE

50       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
51       if not.
52

SEE ALSO

54       CURLOPT_MAX_RECV_SPEED_LARGE(3), CURLOPT_WRITEFUNCTION(3),
55
56
57
58libcurl 7.69.1                   May 13, 2017            CURLOPT_BUFFERSIZE(3)
Impressum