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