2
0

CURLOPT_CONNECTTIMEOUT.3 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 CURLOPT_CONNECTTIMEOUT 3 "17 Jun 2014" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_CONNECTTIMEOUT \- timeout for the connect phase
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECTTIMEOUT, long timeout);
  32. .fi
  33. .SH DESCRIPTION
  34. Pass a long. It should contain the maximum time in seconds that you allow the
  35. connection phase to the server to take. This only limits the connection
  36. phase, it has no impact once it has connected. Set to zero to switch to the
  37. default built-in connection timeout - 300 seconds. See also the
  38. \fICURLOPT_TIMEOUT(3)\fP option.
  39. In unix-like systems, this might cause signals to be used unless
  40. \fICURLOPT_NOSIGNAL(3)\fP is set.
  41. If both \fICURLOPT_CONNECTTIMEOUT(3)\fP and \fICURLOPT_CONNECTTIMEOUT_MS(3)\fP
  42. are set, the value set last will be used.
  43. The "connection phase" is considered complete when the requested TCP, TLS or
  44. QUIC handshakes are done.
  45. .SH DEFAULT
  46. 300
  47. .SH PROTOCOLS
  48. All
  49. .SH EXAMPLE
  50. .nf
  51. CURL *curl = curl_easy_init();
  52. if(curl) {
  53. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  54. /* complete connection within 10 seconds */
  55. curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10L);
  56. curl_easy_perform(curl);
  57. }
  58. .fi
  59. .SH AVAILABILITY
  60. Always
  61. .SH RETURN VALUE
  62. Returns CURLE_OK. Returns CURLE_BAD_FUNCTION_ARGUMENT if set to a negative
  63. value or a value that when converted to milliseconds is too large.
  64. .SH "SEE ALSO"
  65. .BR CURLOPT_CONNECTTIMEOUT_MS "(3), "
  66. .BR CURLOPT_TIMEOUT "(3), " CURLOPT_LOW_SPEED_LIMIT "(3), "