1CURLMOPT_MAX_TOTAL_CONNECTIONS(3) libcurl CURLMOPT_MAX_TOTAL_CONNECTIONS(3)
2
3
4
6 CURLMOPT_MAX_TOTAL_CONNECTIONS - max simultaneously open connections
7
9 #include <curl/curl.h>
10
11 CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_TOTAL_CONNECTIONS,
12 long amount);
13
15 Pass a long for the amount. The set number will be used as the maximum
16 number of simultaneously open connections in total using this multi
17 handle. For each new session, libcurl will open a new connection up to
18 the limit set by CURLMOPT_MAX_TOTAL_CONNECTIONS(3). When the limit is
19 reached, the sessions will be pending until there are available connec‐
20 tions. If CURLMOPT_PIPELINING(3) is enabled, libcurl will try to use
21 multiplexing if the host is capable of it.
22
23 When more transfers are added to the multi handle than what can be per‐
24 formed due to the set limit, they will be queued up waiting for their
25 chance. When that happens, the CURLOPT_TIMEOUT_MS(3) timeout will be
26 counted inclusive of the waiting time, meaning that if you set a too
27 narrow timeout in such a case the transfer might never even start be‐
28 fore it times out.
29
30 Even in the queued up situation, the CURLOPT_CONNECTTIMEOUT_MS(3) time‐
31 out is however treated as a per-connect timeout.
32
34 The default value is 0, which means that there is no limit. It is then
35 simply controlled by the number of easy handles added.
36
38 All
39
41 CURLM *m = curl_multi_init();
42 /* never do more than 15 connections */
43 curl_multi_setopt(m, CURLMOPT_MAX_TOTAL_CONNECTIONS, 15L);
44
46 Added in 7.30.0
47
49 Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION
50 if not.
51
53 CURLMOPT_MAXCONNECTS(3), CURLMOPT_MAX_HOST_CONNECTIONS(3),
54
55
56
57ibcurl 8.2.1 April 26, 2023CURLMOPT_MAX_TOTAL_CONNECTIONS(3)