CURLMOPT_MAX_HOST_CONNECTIONS.3 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLMOPT_MAX_HOST_CONNECTIONS 3 "January 02, 2023" "libcurl 7.88.1" "curl_multi_setopt options"
  26. .SH NAME
  27. CURLMOPT_MAX_HOST_CONNECTIONS \- max number of connections to a single host
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_HOST_CONNECTIONS,
  32. long max);
  33. .fi
  34. .SH DESCRIPTION
  35. Pass a long to indicate \fBmax\fP. The set number will be used as the maximum
  36. amount of simultaneously open connections to a single host (a host being the
  37. same as a host name + port number pair). For each new session to a host,
  38. libcurl will open a new connection up to the limit set by
  39. \fICURLMOPT_MAX_HOST_CONNECTIONS(3)\fP. When the limit is reached, the
  40. sessions will be pending until a connection becomes available. If
  41. \fICURLMOPT_PIPELINING(3)\fP is enabled, libcurl will try to pipeline if the
  42. host is capable of it.
  43. The default \fBmax\fP value is 0, unlimited. However, for backwards
  44. compatibility, setting it to 0 when \fICURLMOPT_PIPELINING(3)\fP is 1 will not
  45. be treated as unlimited. Instead it will open only 1 connection and try to
  46. pipeline on it.
  47. This set limit is also used for proxy connections, and then the proxy is
  48. considered to be the host for which this limit counts.
  49. When more transfers are added to the multi handle than what can be performed
  50. due to the set limit, they will be queued up waiting for their chance. When
  51. that happens, the \fICURLOPT_TIMEOUT_MS(3)\fP timeout will be counted
  52. inclusive of the waiting time, meaning that if you set a too narrow timeout in
  53. such a case the transfer might never even start before it times out.
  54. Even in the queued up situation, the \fICURLOPT_CONNECTTIMEOUT_MS(3)\fP
  55. timeout is however treated as a per-connect timeout.
  56. .SH DEFAULT
  57. 0
  58. .SH PROTOCOLS
  59. HTTP(S)
  60. .SH EXAMPLE
  61. .nf
  62. CURLM *m = curl_multi_init();
  63. /* do no more than 2 connections per host */
  64. curl_multi_setopt(m, CURLMOPT_MAX_HOST_CONNECTIONS, 2L);
  65. .fi
  66. .SH AVAILABILITY
  67. Added in 7.30.0
  68. .SH RETURN VALUE
  69. Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not.
  70. .SH "SEE ALSO"
  71. .BR CURLMOPT_MAXCONNECTS "(3), " CURLMOPT_MAX_TOTAL_CONNECTIONS "(3), "