1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.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) 10Protocol: 11 - All 12--- 13 14# NAME 15 16CURLMOPT_MAXCONNECTS - size of connection cache 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAXCONNECTS, long max); 24~~~ 25 26# DESCRIPTION 27 28Pass a long indicating the **max**. The set number is used as the maximum 29amount of simultaneously open connections that libcurl may keep in its 30connection cache after completed use. By default libcurl enlarges the size for 31each added easy handle to make it fit 4 times the number of added easy 32handles. 33 34By setting this option, you can prevent the cache size from growing beyond the 35limit set by you. 36 37When the cache is full, curl closes the oldest one in the cache to prevent the 38number of open connections from increasing. 39 40This option is for the multi handle's use only, when using the easy interface 41you should instead use the CURLOPT_MAXCONNECTS(3) option. 42 43See CURLMOPT_MAX_TOTAL_CONNECTIONS(3) for limiting the number of active 44connections. 45 46Changing this value when there are transfers in progress is possible, and the 47new value is then used the next time checks are performed. Lowering the value 48does however not close down any active transfers, it simply does not allow new 49ones to get made. 50 51# DEFAULT 52 53See DESCRIPTION 54 55# EXAMPLE 56 57~~~c 58int main(void) 59{ 60 CURLM *m = curl_multi_init(); 61 /* only keep 10 connections in the cache */ 62 curl_multi_setopt(m, CURLMOPT_MAXCONNECTS, 10L); 63} 64~~~ 65 66# AVAILABILITY 67 68Added in 7.16.3 69 70# RETURN VALUE 71 72Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. 73