1CURLOPT_MAXCONNECTS(3)              libcurl             CURLOPT_MAXCONNECTS(3)
2
3
4

NAME

6       CURLOPT_MAXCONNECTS - maximum connection cache size
7

SYNOPSIS

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

DESCRIPTION

14       Pass  a  long.  The set amount will be the maximum number of simultane‐
15       ously open persistent connections that libcurl may cache  in  the  pool
16       associated  with  this  handle. The default is 5, and there is not much
17       point in changing this value unless you are perfectly aware of how this
18       works  and  changes libcurl's behavior. This concerns connections using
19       any of the protocols that support persistent connections.
20
21       When reaching the maximum limit, curl closes  the  oldest  one  in  the
22       cache to prevent increasing the number of open connections.
23
24       If  you already have performed transfers with this curl handle, setting
25       a smaller CURLOPT_MAXCONNECTS(3) than before may cause open connections
26       to get closed unnecessarily.
27
28       If  you add this easy handle to a multi handle, this setting is not ac‐
29       knowledged, and you must instead use curl_multi_setopt(3) and the CURL‐
30       MOPT_MAXCONNECTS(3) option.
31

DEFAULT

33       5
34

PROTOCOLS

36       Most
37

EXAMPLE

39       CURL *curl = curl_easy_init();
40       if(curl) {
41         CURLcode ret;
42         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
43         /* limit the connection cache for this handle to no more than 3 */
44         curl_easy_setopt(curl, CURLOPT_MAXCONNECTS, 3L);
45         ret = curl_easy_perform(curl);
46       }
47

AVAILABILITY

49       Always
50

RETURN VALUE

52       Returns CURLE_OK
53

SEE ALSO

55       CURLMOPT_MAXCONNECTS(3), CURLOPT_MAXREDIRS(3),
56
57
58
59ibcurl 8.2.1                    April 26, 2023          CURLOPT_MAXCONNECTS(3)
Impressum