CURLOPT_TCP_KEEPIDLE.3 1.4 KB

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