1CURLMOPT_MAX_HOST_CONNECTIONcSu(r3l)_multi_setopt opCtUiRoLnMsOPT_MAX_HOST_CONNECTIONS(3)
2
3
4
6 CURLMOPT_MAX_HOST_CONNECTIONS - set max number of connections to a sin‐
7 gle host
8
10 #include <curl/curl.h>
11
12 CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_HOST_CONNEC‐
13 TIONS, long max);
14
16 Pass a long to indicate max. The set number will be used as the maximum
17 amount of simultaneously open connections to a single host (a host
18 being the same as a host name + port number pair). For each new session
19 to a host, libcurl will open a new connection up to the limit set by
20 CURLMOPT_MAX_HOST_CONNECTIONS(3). When the limit is reached, the ses‐
21 sions will be pending until a connection becomes available. If CURL‐
22 MOPT_PIPELINING(3) is enabled, libcurl will try to pipeline if the host
23 is capable of it.
24
25 The default max value is 0, unlimited. However, for backwards compati‐
26 bility, setting it to 0 when CURLMOPT_PIPELINING(3) is 1 will not be
27 treated as unlimited. Instead it will open only 1 connection and try to
28 pipeline on it.
29
30 This set limit is also used for proxy connections, and then the proxy
31 is considered to be the host for which this limit counts.
32
34 0
35
37 HTTP(S)
38
40 CURLM *m = curl_multi_init();
41 /* do no more than 2 connections per host */
42 curl_multi_setopt(m, CURLMOPT_MAX_HOST_CONNECTIONS, 2L);
43
45 Added in 7.30.0
46
48 Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION
49 if not.
50
52 CURLMOPT_MAXCONNECTS(3), CURLMOPT_MAX_TOTAL_CONNECTIONS(3),
53
54
55
56libcurl 7.61.1 May 27, 2017 CURLMOPT_MAX_HOST_CONNECTIONS(3)