1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_SERVER_RESPONSE_TIMEOUT_MS
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_CONNECTTIMEOUT (3)
9  - CURLOPT_LOW_SPEED_LIMIT (3)
10  - CURLOPT_TIMEOUT (3)
11Protocol:
12  - FTP
13  - IMAP
14  - POP3
15  - SMTP
16  - SFTP
17  - SCP
18---
19
20# NAME
21
22CURLOPT_SERVER_RESPONSE_TIMEOUT_MS - time allowed to wait for server response
23
24# SYNOPSIS
25
26~~~c
27#include <curl/curl.h>
28
29CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SERVER_RESPONSE_TIMEOUT_MS,
30                          long timeout);
31~~~
32
33# DESCRIPTION
34
35Pass a long. Causes libcurl to set a *timeout* period (in milliseconds) on the
36amount of time that the server is allowed to take in order to send a response
37message for a command before the session is considered dead. While libcurl is
38waiting for a response, this value overrides CURLOPT_TIMEOUT(3). It is
39recommended that if used in conjunction with CURLOPT_TIMEOUT(3), you set
40CURLOPT_SERVER_RESPONSE_TIMEOUT_MS(3) to a value smaller than
41CURLOPT_TIMEOUT(3).
42
43The maximum accepted value is 2147483648.
44
45This is the millisecond version of CURLOPT_SERVER_RESPONSE_TIMEOUT(3).
46
47# DEFAULT
48
49None
50
51# EXAMPLE
52
53~~~c
54int main(void)
55{
56  CURL *curl = curl_easy_init();
57  if(curl) {
58    CURLcode res;
59    curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/slow.txt");
60    /* wait no more than 237 milliseconds */
61    curl_easy_setopt(curl, CURLOPT_SERVER_RESPONSE_TIMEOUT_MS, 237L);
62    res = curl_easy_perform(curl);
63
64    curl_easy_cleanup(curl);
65  }
66}
67~~~
68
69# AVAILABILITY
70
71Added in 8.6.0.
72
73# RETURN VALUE
74
75Returns CURLE_OK if supported, and CURLE_UNKNOWN_OPTION if not. Returns
76CURLE_BAD_FUNCTION_ARGUMENT if set to a negative value or a value that when
77converted to milliseconds is too large.
78