GNURLOPT_TCP_NODELAY(3)
Okay bestie, welcome to GNURLOPT_TCP_NODELAY(3) β this page lives in the curl_easy_setopt options manual, and it's literally all about one tiny TCP switch. Buckle up, it's giving networking but make it cute. π¦
β¨ NAME β¨
CURLOPT_TCP_NODELAY β set the TCP_NODELAY option. That's the whole vibe. π
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_NODELAY, long
nodelay);
β¨ DESCRIPTION β¨
Pass a long specifying whether the TCP_NODELAY option is to be set or cleared (1L = set, 0 = clear). The option is set by default, bestie. π
β οΈ Timing tea: this will have no effect after the connection has been established. So like, do it before the connection is already out the door, okay? π
Setting this option to 1L will disable TCP's Nagle algorithm on this connection. The purpose of this algorithm is to try to minimize the number of small packets on the network β and yes, "small packets" means TCP segments less than the Maximum Segment Size (MSS) for the network. π§
Maximizing the amount of data sent per TCP segment is good because it amortizes the overhead of the send. However, in some cases small segments may need to be sent without delay. This is less efficient than sending larger amounts of data at a time, and can contribute to congestion on the network if overdone. No cap, don't overdo it. π₯
π DEFAULT π
1 β she's set by default, periodt. β¨
π PROTOCOLS π
All β every protocol, bestie. All of 'em. π
π EXAMPLE π
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
/* disable Nagle */
curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 0);
curl_easy_perform(curl);
}
π¦ AVAILABILITY π¦
Always. The default was changed to 1 from 0 in 7.50.2. Iconic little glow-up behavior. π
β RETURN VALUE β
Returns CURLE_OK β that's the good one, bestie. π«Ά
πΈ SEE ALSO πΈ
Signed, sealed, slayed: libcurl 7.50.0, dated 30 Jun 2016, and the manual page is GNURLOPT_TCP_NODELAY(3). Mwah πβ¨
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms