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)
10Protocol:
11  - All
12---
13
14# NAME
15
16CURLOPT_TCP_KEEPINTVL - TCP keep-alive interval
17
18# SYNOPSIS
19
20~~~c
21#include <curl/curl.h>
22
23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_KEEPINTVL, long interval);
24~~~
25
26# DESCRIPTION
27
28Pass a long. Sets the interval, in seconds, to wait between sending keepalive
29probes. Not all operating systems support this option. (Added in 7.25.0)
30
31The maximum value this accepts is 2147483648. Any larger value is capped to
32this amount.
33
34# DEFAULT
35
3660
37
38# EXAMPLE
39
40~~~c
41int main(void)
42{
43  CURL *curl = curl_easy_init();
44  if(curl) {
45    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
46
47    /* enable TCP keep-alive for this transfer */
48    curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
49
50    /* set keep-alive idle time to 120 seconds */
51    curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
52
53    /* interval time between keep-alive probes: 60 seconds */
54    curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L);
55
56    curl_easy_perform(curl);
57  }
58}
59~~~
60
61# AVAILABILITY
62
63Always
64
65# RETURN VALUE
66
67Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
68