CURLOPT_TCP_KEEPINTVL.3 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. .\" generated by cd2nroff 0.1 from CURLOPT_TCP_KEEPINTVL.md
  2. .TH CURLOPT_TCP_KEEPINTVL 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_TCP_KEEPINTVL \- TCP keep\-alive interval
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_KEEPINTVL, long interval);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a long. Sets the interval, in seconds, to wait between sending keepalive
  12. probes. Not all operating systems support this option. (Added in 7.25.0)
  13. The maximum value this accepts is 2147483648. Any larger value is capped to
  14. this amount.
  15. .SH DEFAULT
  16. 60
  17. .SH PROTOCOLS
  18. This functionality affects tcp only
  19. .SH EXAMPLE
  20. .nf
  21. int main(void)
  22. {
  23. CURL *curl = curl_easy_init();
  24. if(curl) {
  25. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  26. /* enable TCP keep-alive for this transfer */
  27. curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
  28. /* set keep-alive idle time to 120 seconds */
  29. curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 120L);
  30. /* interval time between keep-alive probes: 60 seconds */
  31. curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L);
  32. /* maximum number of keep-alive probes: 3 */
  33. curl_easy_setopt(curl, CURLOPT_TCP_KEEPCNT, 3L);
  34. curl_easy_perform(curl);
  35. }
  36. }
  37. .fi
  38. .SH AVAILABILITY
  39. Added in curl 7.25.0
  40. .SH RETURN VALUE
  41. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  42. .SH SEE ALSO
  43. .BR CURLOPT_TCP_KEEPALIVE (3),
  44. .BR CURLOPT_TCP_KEEPCNT (3),
  45. .BR CURLOPT_TCP_KEEPIDLE (3)