CURLOPT_UPKEEP_INTERVAL_MS.3 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 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. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_UPKEEP_INTERVAL_MS 3 "January 02, 2023" "libcurl 7.88.1" "curl_easy_setopt options"
  26. .SH NAME
  27. CURLOPT_UPKEEP_INTERVAL_MS \- connection upkeep interval
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPKEEP_INTERVAL_MS,
  32. long upkeep_interval_ms);
  33. .fi
  34. .SH DESCRIPTION
  35. Some protocols have "connection upkeep" mechanisms. These mechanisms usually
  36. send some traffic on existing connections in order to keep them alive; this
  37. can prevent connections from being closed due to overzealous firewalls, for
  38. example.
  39. The user needs to explicitly call \fIcurl_easy_upkeep(3)\fP in order to
  40. perform the upkeep work.
  41. Currently the only protocol with a connection upkeep mechanism is HTTP/2: when
  42. the connection upkeep interval is exceeded and \fIcurl_easy_upkeep(3)\fP
  43. is called, an HTTP/2 PING frame is sent on the connection.
  44. .SH DEFAULT
  45. CURL_UPKEEP_INTERVAL_DEFAULT (currently defined as 60000L, which is 60 seconds)
  46. .SH PROTOCOLS
  47. All
  48. .SH EXAMPLE
  49. .nf
  50. CURL *curl = curl_easy_init();
  51. if(curl) {
  52. /* Make a connection to an HTTP/2 server. */
  53. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  54. /* Set the interval to 30000ms / 30s */
  55. curl_easy_setopt(curl, CURLOPT_UPKEEP_INTERVAL_MS, 30000L);
  56. curl_easy_perform(curl);
  57. /* Perform more work here. */
  58. /* While the connection is being held open, curl_easy_upkeep() can be
  59. called. If curl_easy_upkeep() is called and the time since the last
  60. upkeep exceeds the interval, then an HTTP/2 PING is sent. */
  61. curl_easy_upkeep(curl);
  62. /* Perform more work here. */
  63. /* always cleanup */
  64. curl_easy_cleanup(curl);
  65. }
  66. .fi
  67. .SH AVAILABILITY
  68. Added in 7.62.0
  69. .SH RETURN VALUE
  70. Returns CURLE_OK
  71. .SH SEE ALSO
  72. .BR CURLOPT_TCP_KEEPALIVE "(3), "