CURLMOPT_MAX_HOST_CONNECTIONS.3 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2021, 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. .\" **************************************************************************
  22. .\"
  23. .TH CURLMOPT_MAX_HOST_CONNECTIONS 3 "17 Jun 2014" "libcurl 7.37.0" "curl_multi_setopt options"
  24. .SH NAME
  25. CURLMOPT_MAX_HOST_CONNECTIONS \- max number of connections to a single host
  26. .SH SYNOPSIS
  27. .nf
  28. #include <curl/curl.h>
  29. CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_HOST_CONNECTIONS,
  30. long max);
  31. .fi
  32. .SH DESCRIPTION
  33. Pass a long to indicate \fBmax\fP. The set number will be used as the maximum
  34. amount of simultaneously open connections to a single host (a host being the
  35. same as a host name + port number pair). For each new session to a host,
  36. libcurl will open a new connection up to the limit set by
  37. \fICURLMOPT_MAX_HOST_CONNECTIONS(3)\fP. When the limit is reached, the
  38. sessions will be pending until a connection becomes available. If
  39. \fICURLMOPT_PIPELINING(3)\fP is enabled, libcurl will try to pipeline if the
  40. host is capable of it.
  41. The default \fBmax\fP value is 0, unlimited. However, for backwards
  42. compatibility, setting it to 0 when \fICURLMOPT_PIPELINING(3)\fP is 1 will not
  43. be treated as unlimited. Instead it will open only 1 connection and try to
  44. pipeline on it.
  45. This set limit is also used for proxy connections, and then the proxy is
  46. considered to be the host for which this limit counts.
  47. When more transfers are added to the multi handle than what can be performed
  48. due to the set limit, they will be queued up waiting for their chance. When
  49. that happens, the \fICURLOPT_TIMEOUT_MS(3)\fP timeout will be counted
  50. inclusive of the waiting time, meaning that if you set a too narrow timeout in
  51. such a case the transfer might never even start before it times out.
  52. Even in the queued up situation, the \fICURLOPT_CONNECTTIMEOUT_MS(3)\fP
  53. timeout is however treated as a per-connect timeout.
  54. .SH DEFAULT
  55. 0
  56. .SH PROTOCOLS
  57. HTTP(S)
  58. .SH EXAMPLE
  59. .nf
  60. CURLM *m = curl_multi_init();
  61. /* do no more than 2 connections per host */
  62. curl_multi_setopt(m, CURLMOPT_MAX_HOST_CONNECTIONS, 2L);
  63. .fi
  64. .SH AVAILABILITY
  65. Added in 7.30.0
  66. .SH RETURN VALUE
  67. Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not.
  68. .SH "SEE ALSO"
  69. .BR CURLMOPT_MAXCONNECTS "(3), " CURLMOPT_MAX_TOTAL_CONNECTIONS "(3), "