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

NAME

6       CURLOPT_TCP_NODELAY - set the TCP_NODELAY option
7

SYNOPSIS

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

DESCRIPTION

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

DEFAULT

31       1
32

PROTOCOLS

34       All
35

EXAMPLE

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

AVAILABILITY

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

RETURN VALUE

49       Returns CURLE_OK
50

SEE ALSO

52       CURLOPT_SOCKOPTFUNCTION(3), CURLOPT_TCP_KEEPALIVE(3),
53
54
55
56libcurl 7.76.1                 November 04, 2020        CURLOPT_TCP_NODELAY(3)
Impressum