1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLMOPT_MAXCONNECTS 5Section: 3 6Source: libcurl 7See-also: 8 - CURLMOPT_MAX_HOST_CONNECTIONS (3) 9 - CURLOPT_MAXCONNECTS (3) 10--- 11 12# NAME 13 14CURLMOPT_MAXCONNECTS - size of connection cache 15 16# SYNOPSIS 17 18~~~c 19#include <curl/curl.h> 20 21CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAXCONNECTS, long max); 22~~~ 23 24# DESCRIPTION 25 26Pass a long indicating the **max**. The set number is used as the maximum 27amount of simultaneously open connections that libcurl may keep in its 28connection cache after completed use. By default libcurl enlarges the size for 29each added easy handle to make it fit 4 times the number of added easy 30handles. 31 32By setting this option, you can prevent the cache size from growing beyond the 33limit set by you. 34 35When the cache is full, curl closes the oldest one in the cache to prevent the 36number of open connections from increasing. 37 38This option is for the multi handle's use only, when using the easy interface 39you should instead use the CURLOPT_MAXCONNECTS(3) option. 40 41See CURLMOPT_MAX_TOTAL_CONNECTIONS(3) for limiting the number of active 42connections. 43 44# DEFAULT 45 46See DESCRIPTION 47 48# PROTOCOLS 49 50All 51 52# EXAMPLE 53 54~~~c 55int main(void) 56{ 57 CURLM *m = curl_multi_init(); 58 /* only keep 10 connections in the cache */ 59 curl_multi_setopt(m, CURLMOPT_MAXCONNECTS, 10L); 60} 61~~~ 62 63# AVAILABILITY 64 65Added in 7.16.3 66 67# RETURN VALUE 68 69Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. 70