CURLOPT_SERVER_RESPONSE_TIMEOUT.3 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. .\" generated by cd2nroff 0.1 from CURLOPT_SERVER_RESPONSE_TIMEOUT.md
  2. .TH CURLOPT_SERVER_RESPONSE_TIMEOUT 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_SERVER_RESPONSE_TIMEOUT \- time allowed to wait for server response
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SERVER_RESPONSE_TIMEOUT,
  9. long timeout);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a long. Causes libcurl to set a \fItimeout\fP period (in seconds) on the
  13. amount of time that the server is allowed to take in order to send a response
  14. message for a command before the session is considered dead. While libcurl is
  15. waiting for a response, this value overrides \fICURLOPT_TIMEOUT(3)\fP. It is
  16. recommended that if used in conjunction with \fICURLOPT_TIMEOUT(3)\fP, you set
  17. \fICURLOPT_SERVER_RESPONSE_TIMEOUT(3)\fP to a value smaller than
  18. \fICURLOPT_TIMEOUT(3)\fP.
  19. This option was formerly known as CURLOPT_FTP_RESPONSE_TIMEOUT.
  20. .SH DEFAULT
  21. None
  22. .SH PROTOCOLS
  23. This functionality affects ftp, imap, pop3, scp, sftp and smtp
  24. .SH EXAMPLE
  25. .nf
  26. int main(void)
  27. {
  28. CURL *curl = curl_easy_init();
  29. if(curl) {
  30. CURLcode res;
  31. curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/slow.txt");
  32. /* wait no more than 23 seconds */
  33. curl_easy_setopt(curl, CURLOPT_SERVER_RESPONSE_TIMEOUT, 23L);
  34. res = curl_easy_perform(curl);
  35. curl_easy_cleanup(curl);
  36. }
  37. }
  38. .fi
  39. .SH AVAILABILITY
  40. Added in curl 7.20.0
  41. .SH RETURN VALUE
  42. Returns CURLE_OK if supported, and CURLE_UNKNOWN_OPTION if not. Returns
  43. CURLE_BAD_FUNCTION_ARGUMENT if set to a negative value or a value that when
  44. converted to milliseconds is too large.
  45. .SH SEE ALSO
  46. .BR CURLOPT_CONNECTTIMEOUT (3),
  47. .BR CURLOPT_LOW_SPEED_LIMIT (3),
  48. .BR CURLOPT_TIMEOUT (3)