1*6236dae4SAndroid Build Coastguard Worker--- 2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al. 3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl 4*6236dae4SAndroid Build Coastguard WorkerTitle: CURLMOPT_MAXCONNECTS 5*6236dae4SAndroid Build Coastguard WorkerSection: 3 6*6236dae4SAndroid Build Coastguard WorkerSource: libcurl 7*6236dae4SAndroid Build Coastguard WorkerSee-also: 8*6236dae4SAndroid Build Coastguard Worker - CURLMOPT_MAX_HOST_CONNECTIONS (3) 9*6236dae4SAndroid Build Coastguard Worker - CURLOPT_MAXCONNECTS (3) 10*6236dae4SAndroid Build Coastguard WorkerProtocol: 11*6236dae4SAndroid Build Coastguard Worker - All 12*6236dae4SAndroid Build Coastguard WorkerAdded-in: 7.16.3 13*6236dae4SAndroid Build Coastguard Worker--- 14*6236dae4SAndroid Build Coastguard Worker 15*6236dae4SAndroid Build Coastguard Worker# NAME 16*6236dae4SAndroid Build Coastguard Worker 17*6236dae4SAndroid Build Coastguard WorkerCURLMOPT_MAXCONNECTS - size of connection cache 18*6236dae4SAndroid Build Coastguard Worker 19*6236dae4SAndroid Build Coastguard Worker# SYNOPSIS 20*6236dae4SAndroid Build Coastguard Worker 21*6236dae4SAndroid Build Coastguard Worker~~~c 22*6236dae4SAndroid Build Coastguard Worker#include <curl/curl.h> 23*6236dae4SAndroid Build Coastguard Worker 24*6236dae4SAndroid Build Coastguard WorkerCURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAXCONNECTS, long max); 25*6236dae4SAndroid Build Coastguard Worker~~~ 26*6236dae4SAndroid Build Coastguard Worker 27*6236dae4SAndroid Build Coastguard Worker# DESCRIPTION 28*6236dae4SAndroid Build Coastguard Worker 29*6236dae4SAndroid Build Coastguard WorkerPass a long indicating the **max**, the maximum amount of connections that 30*6236dae4SAndroid Build Coastguard Workerlibcurl may keep alive in its connection cache after use. By default libcurl 31*6236dae4SAndroid Build Coastguard Workerenlarges the size for each added easy handle to make it fit 4 times the number 32*6236dae4SAndroid Build Coastguard Workerof added easy handles. 33*6236dae4SAndroid Build Coastguard Worker 34*6236dae4SAndroid Build Coastguard WorkerBy setting this option, you prevent the cache size from growing beyond the 35*6236dae4SAndroid Build Coastguard Workerlimit set by you. 36*6236dae4SAndroid Build Coastguard Worker 37*6236dae4SAndroid Build Coastguard WorkerWhen the cache is full, curl closes the oldest connection present in the cache 38*6236dae4SAndroid Build Coastguard Workerto prevent the number of connections from increasing. 39*6236dae4SAndroid Build Coastguard Worker 40*6236dae4SAndroid Build Coastguard WorkerThis option is for the multi handle's use only, when using the easy interface 41*6236dae4SAndroid Build Coastguard Workeryou should instead use the CURLOPT_MAXCONNECTS(3) option. 42*6236dae4SAndroid Build Coastguard Worker 43*6236dae4SAndroid Build Coastguard WorkerSee CURLMOPT_MAX_TOTAL_CONNECTIONS(3) for limiting the number of active 44*6236dae4SAndroid Build Coastguard Workerconnections. 45*6236dae4SAndroid Build Coastguard Worker 46*6236dae4SAndroid Build Coastguard WorkerChanging this value when there are transfers in progress is possible, and the 47*6236dae4SAndroid Build Coastguard Workernew value is then used the next time checks are performed. Lowering the value 48*6236dae4SAndroid Build Coastguard Workerdoes not close down any active transfers, it simply does not allow new ones to 49*6236dae4SAndroid Build Coastguard Workerget made. 50*6236dae4SAndroid Build Coastguard Worker 51*6236dae4SAndroid Build Coastguard Worker# DEFAULT 52*6236dae4SAndroid Build Coastguard Worker 53*6236dae4SAndroid Build Coastguard WorkerSee DESCRIPTION 54*6236dae4SAndroid Build Coastguard Worker 55*6236dae4SAndroid Build Coastguard Worker# %PROTOCOLS% 56*6236dae4SAndroid Build Coastguard Worker 57*6236dae4SAndroid Build Coastguard Worker# EXAMPLE 58*6236dae4SAndroid Build Coastguard Worker 59*6236dae4SAndroid Build Coastguard Worker~~~c 60*6236dae4SAndroid Build Coastguard Workerint main(void) 61*6236dae4SAndroid Build Coastguard Worker{ 62*6236dae4SAndroid Build Coastguard Worker CURLM *m = curl_multi_init(); 63*6236dae4SAndroid Build Coastguard Worker /* only keep 10 connections in the cache */ 64*6236dae4SAndroid Build Coastguard Worker curl_multi_setopt(m, CURLMOPT_MAXCONNECTS, 10L); 65*6236dae4SAndroid Build Coastguard Worker} 66*6236dae4SAndroid Build Coastguard Worker~~~ 67*6236dae4SAndroid Build Coastguard Worker 68*6236dae4SAndroid Build Coastguard Worker# %AVAILABILITY% 69*6236dae4SAndroid Build Coastguard Worker 70*6236dae4SAndroid Build Coastguard Worker# RETURN VALUE 71*6236dae4SAndroid Build Coastguard Worker 72*6236dae4SAndroid Build Coastguard WorkerReturns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. 73