GNURLOPT_TCP_KEEPIDLE(3)
okay bestie, welcome to GNURLOPT_TCP_KEEPIDLE(3) from the curl_easy_setopt options manual β the page about setting TCP keep-alive idle time wait. Yes, we're talking about how long the OS chills on an idle connection before it starts sending keepalive probes. Let's go π β¨
πΈ NAME πΈ
CURLOPT_TCP_KEEPIDLE β set TCP keep-alive idle time wait. That's the whole assignment. π
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_KEEPIDLE, long
delay);
π¦ DESCRIPTION π¦
You pass a long. That sets the delay, in seconds, that the operating system will wait while the connection is idle before sending keepalive probes.
β οΈ caveat, bestie: not all operating systems support this option. So if your OS doesn't have it, that's not a you problem β it's just not supported there. π«Ά
π DEFAULT π
Default is 60.
π PROTOCOLS π
All β every protocol, no cap. π―
π EXAMPLE π
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
/* enable TCP keep-alive for this transfer */
curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
/* set keep-alive idle time to 120 seconds */
curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
/* interval time between keep-alive probes: 60 seconds */
curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L);
curl_easy_perform(curl);
}
π AVAILABILITY π
Added in 7.25.0. It's been iconic for a minute. β¨
π RETURN VALUE π
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
π§ SEE ALSO π§
xoxo, from the libcurl 7.37.0 era, dated 19 Jun 2014 β and yes, this page is GNURLOPT_TCP_KEEPIDLE(3). ππ«Ά
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms