CURLOPT_UPKEEP_INTERVAL_MS.3 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" **************************************************************************
  22. .\"
  23. .TH CURLOPT_UPKEEP_INTERVAL_MS 3 "31 Oct 2018" "libcurl 7.62.0" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_UPKEEP_INTERVAL_MS \- connection upkeep interval
  26. .SH SYNOPSIS
  27. .nf
  28. #include <curl/curl.h>
  29. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPKEEP_INTERVAL_MS,
  30. long upkeep_interval_ms);
  31. .fi
  32. .SH DESCRIPTION
  33. Some protocols have "connection upkeep" mechanisms. These mechanisms usually
  34. send some traffic on existing connections in order to keep them alive; this
  35. can prevent connections from being closed due to overzealous firewalls, for
  36. example.
  37. The user needs to explicitly call \fIcurl_easy_upkeep(3)\fP in order to
  38. perform the upkeep work.
  39. Currently the only protocol with a connection upkeep mechanism is HTTP/2: when
  40. the connection upkeep interval is exceeded and \fIcurl_easy_upkeep(3)\fP
  41. is called, an HTTP/2 PING frame is sent on the connection.
  42. .SH DEFAULT
  43. CURL_UPKEEP_INTERVAL_DEFAULT (currently defined as 60000L, which is 60 seconds)
  44. .SH PROTOCOLS
  45. All
  46. .SH EXAMPLE
  47. .nf
  48. CURL *curl = curl_easy_init();
  49. if(curl) {
  50. /* Make a connection to an HTTP/2 server. */
  51. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  52. /* Set the interval to 30000ms / 30s */
  53. curl_easy_setopt(curl, CURLOPT_UPKEEP_INTERVAL_MS, 30000L);
  54. curl_easy_perform(curl);
  55. /* Perform more work here. */
  56. /* While the connection is being held open, curl_easy_upkeep() can be
  57. called. If curl_easy_upkeep() is called and the time since the last
  58. upkeep exceeds the interval, then an HTTP/2 PING is sent. */
  59. curl_easy_upkeep(curl);
  60. /* Perform more work here. */
  61. /* always cleanup */
  62. curl_easy_cleanup(curl);
  63. }
  64. .fi
  65. .SH AVAILABILITY
  66. Added in 7.62.0
  67. .SH RETURN VALUE
  68. Returns CURLE_OK
  69. .SH SEE ALSO
  70. .BR CURLOPT_TCP_KEEPALIVE "(3), "