1CURLOPT_TCP_KEEPIDLE(3) curl_easy_setopt options CURLOPT_TCP_KEEPIDLE(3)
2
3
4
6 CURLOPT_TCP_KEEPIDLE - TCP keep-alive idle time wait
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_KEEPIDLE, long delay);
12
14 Pass a long. Sets the delay, in seconds, that the operating system will
15 wait while the connection is idle before sending keepalive probes. Not
16 all operating systems support this option.
17
19 60
20
22 All
23
25 CURL *curl = curl_easy_init();
26 if(curl) {
27 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
28
29 /* enable TCP keep-alive for this transfer */
30 curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
31
32 /* set keep-alive idle time to 120 seconds */
33 curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
34
35 /* interval time between keep-alive probes: 60 seconds */
36 curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L);
37
38 curl_easy_perform(curl);
39 }
40
42 Added in 7.25.0
43
45 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
46 if not.
47
49 CURLOPT_TCP_KEEPALIVE(3), CURLOPT_TCP_KEEPINTVL(3),
50
51
52
53libcurl 7.82.0 November 26, 2021 CURLOPT_TCP_KEEPIDLE(3)