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