CURLOPT_TCP_NODELAY.3 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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_TCP_NODELAY 3 "30 Jun 2016" "libcurl 7.50.0" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_TCP_NODELAY \- the TCP_NODELAY option
  26. .SH SYNOPSIS
  27. .nf
  28. #include <curl/curl.h>
  29. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_NODELAY, long nodelay);
  30. .fi
  31. .SH DESCRIPTION
  32. Pass a long specifying whether the TCP_NODELAY option is to be set or cleared
  33. (1L = set, 0 = clear). The option is set by default. This will have no effect
  34. after the connection has been established.
  35. Setting this option to 1L will disable TCP's Nagle algorithm on this
  36. connection. The purpose of this algorithm is to try to minimize the number of
  37. small packets on the network (where "small packets" means TCP segments less
  38. than the Maximum Segment Size (MSS) for the network).
  39. Maximizing the amount of data sent per TCP segment is good because it
  40. amortizes the overhead of the send. However, in some cases small segments may
  41. need to be sent without delay. This is less efficient than sending larger
  42. amounts of data at a time, and can contribute to congestion on the network if
  43. overdone.
  44. .SH DEFAULT
  45. 1
  46. .SH PROTOCOLS
  47. All
  48. .SH EXAMPLE
  49. .nf
  50. CURL *curl = curl_easy_init();
  51. if(curl) {
  52. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  53. /* leave Nagle enabled */
  54. curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 0);
  55. curl_easy_perform(curl);
  56. }
  57. .fi
  58. .SH AVAILABILITY
  59. Always. The default was changed to 1 from 0 in 7.50.2.
  60. .SH RETURN VALUE
  61. Returns CURLE_OK
  62. .SH "SEE ALSO"
  63. .BR CURLOPT_SOCKOPTFUNCTION "(3), " CURLOPT_TCP_KEEPALIVE "(3), "