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
18 The maximum value this accepts is 2147483648. Any larger value will be
19 capped to this amount.
20
22 60
23
25 All
26
28 CURL *curl = curl_easy_init();
29 if(curl) {
30 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
31
32 /* enable TCP keep-alive for this transfer */
33 curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
34
35 /* set keep-alive idle time to 120 seconds */
36 curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
37
38 /* interval time between keep-alive probes: 60 seconds */
39 curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L);
40
41 curl_easy_perform(curl);
42 }
43
45 Added in 7.25.0
46
48 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
49 if not.
50
52 CURLOPT_TCP_KEEPALIVE(3), CURLOPT_TCP_KEEPINTVL(3),
53
54
55
56libcurl 8.0.1 January 02, 2023 CURLOPT_TCP_KEEPIDLE(3)