1CURLOPT_MAXCONNECTS(3)     curl_easy_setopt options     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
12       amount);
13

DESCRIPTION

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

DEFAULT

34       5
35

PROTOCOLS

37       Most
38

EXAMPLE

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

AVAILABILITY

50       Always
51

RETURN VALUE

53       Returns CURLE_OK
54

SEE ALSO

56       CURLMOPT_MAXCONNECTS(3), CURLOPT_MAXREDIRS(3),
57
58
59
60libcurl 7.61.1                   May 30, 2017           CURLOPT_MAXCONNECTS(3)
Impressum