CURLMOPT_MAXCONNECTS.3 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. .\" generated by cd2nroff 0.1 from CURLMOPT_MAXCONNECTS.md
  2. .TH CURLMOPT_MAXCONNECTS 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLMOPT_MAXCONNECTS \- size of connection cache
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAXCONNECTS, long max);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a long indicating the \fBmax\fP. The set number is used as the maximum
  12. amount of simultaneously open connections that libcurl may keep in its
  13. connection cache after completed use. By default libcurl enlarges the size for
  14. each added easy handle to make it fit 4 times the number of added easy
  15. handles.
  16. By setting this option, you can prevent the cache size from growing beyond the
  17. limit set by you.
  18. When the cache is full, curl closes the oldest one in the cache to prevent the
  19. number of open connections from increasing.
  20. This option is for the multi handle\(aqs use only, when using the easy interface
  21. you should instead use the \fICURLOPT_MAXCONNECTS(3)\fP option.
  22. See \fICURLMOPT_MAX_TOTAL_CONNECTIONS(3)\fP for limiting the number of active
  23. connections.
  24. Changing this value when there are transfers in progress is possible, and the
  25. new value is then used the next time checks are performed. Lowering the value
  26. does however not close down any active transfers, it simply does not allow new
  27. ones to get made.
  28. .SH DEFAULT
  29. See DESCRIPTION
  30. .SH PROTOCOLS
  31. This functionality affects all supported protocols
  32. .SH EXAMPLE
  33. .nf
  34. int main(void)
  35. {
  36. CURLM *m = curl_multi_init();
  37. /* only keep 10 connections in the cache */
  38. curl_multi_setopt(m, CURLMOPT_MAXCONNECTS, 10L);
  39. }
  40. .fi
  41. .SH AVAILABILITY
  42. Added in curl 7.16.3
  43. .SH RETURN VALUE
  44. Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not.
  45. .SH SEE ALSO
  46. .BR CURLMOPT_MAX_HOST_CONNECTIONS (3),
  47. .BR CURLOPT_MAXCONNECTS (3)