carta
CURLOPT_TCP_KEEPIDLE(3)

CURLOPT_TCP_KEEPIDLE3

Tcp keep-alive idle time wait

Usage

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_KEEPIDLE, long delay);

Overview

Pass a long. Sets the delay, in seconds, to wait while the connection is idle before sending keepalive probes. Not all operating systems support this option.

The maximum value this accepts is 2147483648. Any larger value is capped to this amount.

Default

60

Protocols

All

Examples

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
    /* enable TCP keep-alive for this transfer */
    curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
    /* set keep-alive idle time to 120 seconds */
    curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
    /* interval time between keep-alive probes: 60 seconds */
    curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L);
    curl_easy_perform(curl);
  }
}

Return value

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.

History

  • macOS 26.5 to macOS 14.5: the text shown here
  • macOS 14.4 to macOS 14.2
  • macOS 14.1 to macOS 13.5
  • macOS 13.4
  • macOS 13.3
  • macOS 13.2
  • macOS 13.1
  • macOS 13.0
  • macOS 12.5 to macOS 12.3
  • macOS 12.2 to macOS 12.0.1
  • macOS 11.5 to macOS 10.15
  • macOS 10.14.6 to macOS 10.12.6
  • macOS 10.12.5 to macOS 10.12
  • OS X 10.11.6 to OS X 10.10.5
  • OS X 10.10.4 to OS X 10.10

Availability

Added in 7.25.0

From curl 166.0.0.0.1 in macOS 26.5. Parsed by carta from the page's man source.