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 de‐
12 lay);
13
15 Pass a long. Sets the delay, in seconds, that the operating system will
16 wait while the connection is idle before sending keepalive probes. Not
17 all operating systems support this option.
18
20 60
21
23 All
24
26 CURL *curl = curl_easy_init();
27 if(curl) {
28 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
29
30 /* enable TCP keep-alive for this transfer */
31 curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
32
33 /* set keep-alive idle time to 120 seconds */
34 curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
35
36 /* interval time between keep-alive probes: 60 seconds */
37 curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L);
38
39 curl_easy_perform(curl);
40 }
41
43 Added in 7.25.0
44
46 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
47 if not.
48
50 CURLOPT_TCP_KEEPALIVE(3), CURLOPT_TCP_KEEPINTVL(3),
51
52
53
54libcurl 7.79.1 September 08, 2021 CURLOPT_TCP_KEEPIDLE(3)