CURLOPT_TCP_KEEPCNT.3 1.5 KB

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