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