1CURLMOPT_MAXCONNECTS(3) curl_multi_setopt options CURLMOPT_MAXCONNECTS(3)
2
3
4
6 CURLMOPT_MAXCONNECTS - set size of connection cache
7
9 #include <curl/curl.h>
10
11 CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAXCONNECTS, long
12 max);
13
15 Pass a long indicating the max. The set number will be used as the max‐
16 imum amount of simultaneously open connections that libcurl may keep in
17 its connection cache after completed use. By default libcurl will en‐
18 large the size for each added easy handle to make it fit 4 times the
19 number of added easy handles.
20
21 By setting this option, you can prevent the cache size from growing be‐
22 yond the limit set by you.
23
24 When the cache is full, curl closes the oldest one in the cache to pre‐
25 vent the number of open connections from increasing.
26
27 This option is for the multi handle's use only, when using the easy in‐
28 terface you should instead use the CURLOPT_MAXCONNECTS(3) option.
29
30 See CURLMOPT_MAX_TOTAL_CONNECTIONS(3) for limiting the number of active
31 connections.
32
33
35 See DESCRIPTION
36
38 All
39
41 CURLM *m = curl_multi_init();
42 /* only keep 10 connections in the cache */
43 curl_multi_setopt(m, CURLMOPT_MAXCONNECTS, 10L);
44
46 Added in 7.16.3
47
49 Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION
50 if not.
51
53 CURLMOPT_MAX_HOST_CONNECTIONS(3), CURLOPT_MAXCONNECTS(3),
54
55
56
57libcurl 7.76.1 November 04, 2020 CURLMOPT_MAXCONNECTS(3)