Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I change TCP_NODELAY in Linux

Posted on 2010-09-15
4
Medium Priority
?
2,387 Views
Last Modified: 2012-05-10
I want to disable the nagle algo on my NIC's due to the type of streaming I am doing, but I cannot find a resouce that says how this is done.
0
Comment
Question by:ericluoma
  • 4
4 Comments
 
LVL 3

Accepted Solution

by:
T1750 earned 2000 total points
ID: 33687422
Here is how to do it for a single socket so you could patch your program. I'll have a further look around for mangling with the filters to do it with all traffic.

int sock = socket( AF_INET, SOCK_STREAM, 0 );
int flag = 1;
int ret = setsockopt( sock, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(flag) );
if (ret < 0 ) {
  perror("TCP_NODELAY");
  exit( EXIT_FAILURE );
}
0
 
LVL 3

Expert Comment

by:T1750
ID: 33687456
You can run a simple proxy server that does nothing but proxy your connection through a socket with TCP_NODELAY set and have iptables transparently NAT it, but coding that is a bit beyond my skill and would take a couple of hours research. A good idea might be to download a SOCKS proxy server and patch it so it's outbound sockets are set as above then run your streaming through the proxy.
0
 
LVL 3

Expert Comment

by:T1750
ID: 33687464
Another solution would be to compile a module that exports socket as a symbol, creates the socket and then returns the value of the socket. You could inject it into your programs with LD_PRELOAD.
0
 
LVL 3

Expert Comment

by:T1750
ID: 33687503
On solaris you can disable nagle system-wide with:

sysctl -w net.ipv4.tcp_abc=0

I just put the same into my Linux box and it accepted the command so I assume it has done the same, but I don't have time to test it.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month11 days, 2 hours left to enroll

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question