CURLOPT_TCP_NODELAY.3 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. .\" generated by cd2nroff 0.1 from CURLOPT_TCP_NODELAY.md
  2. .TH CURLOPT_TCP_NODELAY 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_TCP_NODELAY \- the TCP_NODELAY option
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_NODELAY, long nodelay);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a long specifying whether the \fITCP_NODELAY\fP option is to be set or
  12. cleared (1L = set, 0 = clear). The option is set by default. This has no
  13. effect after the connection has been established.
  14. Setting this option to 1L disables the Nagle algorithm on connections created
  15. using this handle. The purpose of this algorithm is to minimize the number of
  16. small packets on the network (where "small packets" means TCP segments less
  17. than the Maximum Segment Size for the network).
  18. Maximizing the amount of data sent per TCP segment is good because it
  19. amortizes the overhead of the send. However, in some cases small segments may
  20. need to be sent without delay. This is less efficient than sending larger
  21. amounts of data at a time, and can contribute to congestion on the network if
  22. overdone.
  23. .SH DEFAULT
  24. 1
  25. .SH PROTOCOLS
  26. This functionality affects tcp only
  27. .SH EXAMPLE
  28. .nf
  29. int main(void)
  30. {
  31. CURL *curl = curl_easy_init();
  32. if(curl) {
  33. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  34. /* leave Nagle enabled */
  35. curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 0);
  36. curl_easy_perform(curl);
  37. }
  38. }
  39. .fi
  40. .SH HISTORY
  41. The default was changed to 1 from 0 in 7.50.2.
  42. .SH AVAILABILITY
  43. Added in curl 7.11.2
  44. .SH RETURN VALUE
  45. Returns CURLE_OK
  46. .SH SEE ALSO
  47. .BR CURLOPT_BUFFERSIZE (3),
  48. .BR CURLOPT_SOCKOPTFUNCTION (3),
  49. .BR CURLOPT_TCP_KEEPALIVE (3)