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