1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_TCP_KEEPINTVL 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_TCP_KEEPALIVE (3) 9 - CURLOPT_TCP_KEEPIDLE (3) 10 - CURLOPT_TCP_KEEPCNT (3) 11Protocol: 12 - TCP 13Added-in: 7.25.0 14--- 15 16# NAME 17 18CURLOPT_TCP_KEEPINTVL - TCP keep-alive interval 19 20# SYNOPSIS 21 22~~~c 23#include <curl/curl.h> 24 25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_KEEPINTVL, long interval); 26~~~ 27 28# DESCRIPTION 29 30Pass a long. Sets the interval, in seconds, to wait between sending keepalive 31probes. Not all operating systems support this option. (Added in 7.25.0) 32 33The maximum value this accepts is 2147483648. Any larger value is capped to 34this amount. 35 36# DEFAULT 37 3860 39 40# %PROTOCOLS% 41 42# EXAMPLE 43 44~~~c 45int main(void) 46{ 47 CURL *curl = curl_easy_init(); 48 if(curl) { 49 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 50 51 /* enable TCP keep-alive for this transfer */ 52 curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); 53 54 /* set keep-alive idle time to 120 seconds */ 55 curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L); 56 57 /* interval time between keep-alive probes: 60 seconds */ 58 curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L); 59 60 /* maximum number of keep-alive probes: 3 */ 61 curl_easy_setopt(curl, CURLOPT_TCP_KEEPCNT, 3L); 62 63 curl_easy_perform(curl); 64 } 65} 66~~~ 67 68# %AVAILABILITY% 69 70# RETURN VALUE 71 72Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 73