2
0

CURLOPT_TIMEOUT_MS.3 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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_TIMEOUT_MS 3 "17 Jun 2014" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_TIMEOUT_MS \- maximum time the transfer is allowed to complete
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEOUT_MS, long timeout);
  32. .fi
  33. .SH DESCRIPTION
  34. Pass a long as parameter containing \fItimeout\fP - the maximum time in
  35. milliseconds that you allow the libcurl transfer operation to take. Normally,
  36. name lookups can take a considerable time and limiting operations to less than
  37. a few minutes risk aborting perfectly normal operations. This option may cause
  38. libcurl to use the SIGALRM signal to timeout system calls.
  39. If libcurl is built to use the standard system name resolver, that portion of
  40. the transfer will still use full-second resolution for timeouts with a minimum
  41. timeout allowed of one second.
  42. In unix-like systems, this might cause signals to be used unless
  43. \fICURLOPT_NOSIGNAL(3)\fP is set.
  44. If both \fICURLOPT_TIMEOUT(3)\fP and \fICURLOPT_TIMEOUT_MS(3)\fP are set, the
  45. value set last will be used.
  46. Since this puts a hard limit for how long time a request is allowed to take,
  47. it has limited use in dynamic use cases with varying transfer times. You are
  48. then advised to explore \fICURLOPT_LOW_SPEED_LIMIT(3)\fP,
  49. \fICURLOPT_LOW_SPEED_TIME(3)\fP or using \fICURLOPT_PROGRESSFUNCTION(3)\fP to
  50. implement your own timeout logic.
  51. .SH DEFAULT
  52. Default timeout is 0 (zero) which means it never times out during transfer.
  53. .SH PROTOCOLS
  54. All
  55. .SH EXAMPLE
  56. .nf
  57. CURL *curl = curl_easy_init();
  58. if(curl) {
  59. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  60. /* complete within 20000 milliseconds */
  61. curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, 20000L);
  62. curl_easy_perform(curl);
  63. }
  64. .fi
  65. .SH AVAILABILITY
  66. Always
  67. .SH RETURN VALUE
  68. Returns CURLE_OK
  69. .SH "SEE ALSO"
  70. .BR CURLOPT_TIMEOUT "(3), "
  71. .BR CURLOPT_CONNECTTIMEOUT "(3), " CURLOPT_LOW_SPEED_LIMIT "(3), "