1CURLOPT_TCP_NODELAY(3)     curl_easy_setopt options     CURLOPT_TCP_NODELAY(3)
2
3
4

NAME

6       CURLOPT_TCP_NODELAY - the TCP_NODELAY option
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_NODELAY, long nodelay);
12

DESCRIPTION

14       Pass  a  long specifying whether the TCP_NODELAY option is to be set or
15       cleared (1L = set, 0 = clear). The option is set by default. This  will
16       have no effect after the connection has been established.
17
18       Setting  this  option  to 1L will disable TCP's Nagle algorithm on this
19       connection. The purpose of this algorithm is to  try  to  minimize  the
20       number of small packets on the network (where "small packets" means TCP
21       segments less than the Maximum Segment Size (MSS) for the network).
22
23       Maximizing the amount of data sent per TCP segment is good  because  it
24       amortizes  the  overhead of the send. However, in some cases small seg‐
25       ments may need to be sent without delay. This is  less  efficient  than
26       sending larger amounts of data at a time, and can contribute to conges‐
27       tion on the network if overdone.
28

DEFAULT

30       1
31

PROTOCOLS

33       All
34

EXAMPLE

36       CURL *curl = curl_easy_init();
37       if(curl) {
38         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
39         /* leave Nagle enabled */
40         curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 0);
41         curl_easy_perform(curl);
42       }
43

AVAILABILITY

45       Always. The default was changed to 1 from 0 in 7.50.2.
46

RETURN VALUE

48       Returns CURLE_OK
49

SEE ALSO

51       CURLOPT_SOCKOPTFUNCTION(3), CURLOPT_TCP_KEEPALIVE(3),
52
53
54
55libcurl 7.85.0                   May 17, 2022           CURLOPT_TCP_NODELAY(3)
Impressum