CURLOPT_SE...TIMEOUT_MS(3)

πŸ’… CURLOPT_SE...TIMEOUT_MS(3) πŸ’…

okay bestie, welcome to the Library Functions Manual page for libcurl’s CURLOPT_SERVER_RESPONSE_TIMEOUT_MS β€” aka the β€œhow long are we waiting for the server to text back before we assume it ghosted us” setting. πŸ’– This one is lowkey iconic for FTP-ish protocols and very β€œpatience, but make it timed.” ✨


πŸ¦‹ NAME πŸ¦‹

CURLOPT_SERVER_RESPONSE_TIMEOUT_MS β€” time allowed to wait for server response. literally the patience timer, but in milliseconds. β³πŸ’…

πŸŽ€ SYNOPSIS πŸŽ€

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SERVER_RESPONSE_TIMEOUT_MS,
                          long timeout);

🌸 DESCRIPTION 🌸

You pass a long. It tells libcurl to wait no longer than timeout milliseconds for responses on sent commands. If no response is received within this period, the connection is considered dead and the transfer fails. and that’s the dramatic part, bestie β€” no response in time means the connection is declared dead and the transfer fails. πŸ’€βœ¨

It is recommended that if used in conjunction with CURLOPT_TIMEOUT(3), you set CURLOPT_SERVER_RESPONSE_TIMEOUT_MS(3) to a value smaller than CURLOPT_TIMEOUT(3). fr fr, keep this one under the bigger timeout so the vibe check makes sense. 🫢

The maximum accepted value is 2147483648. that’s the ceiling, no cap. πŸ”₯

This is the millisecond version of CURLOPT_SERVER_RESPONSE_TIMEOUT(3). same energy, smaller units. slay. πŸ’…

πŸ“ DEFAULT πŸ“

60000 milliseconds

that’s the default, and yes it is giving β€œone minute of patience.” β³πŸŽ€

🌈 PROTOCOLS 🌈

This functionality affects ftp, imap, pop3, scp, sftp and smtp. iykyk. πŸ¦‹

✨ EXAMPLE ✨

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/slow.txt");
    /* wait no more than 237 milliseconds */
    curl_easy_setopt(curl, CURLOPT_SERVER_RESPONSE_TIMEOUT_MS, 237L);
    result = curl_easy_perform(curl);

    curl_easy_cleanup(curl);
  }
}

not me obsessing over that 237L β€” tiny timeout, big main character energy. πŸ˜­πŸ’–

🧚 AVAILABILITY 🧚

Added in curl 8.6.0

so if you’re on something older, it’s giving β€œnot invited to the group chat.” πŸ™ˆ

πŸ‘‘ RETURN VALUE πŸ‘‘

curl_easy_setopt(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3). periodt. πŸ’…

πŸ’œ SEE ALSO πŸ’œ


xoxo, source/version: libcurl πŸ’– β€” date: 2026-10-12, page: CURLOPT_SE...TIMEOUT_MS(3). byeee 🫢🌸

πŸ“¦ where this page comes from