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