Solved

How do I change TCP_NODELAY in Linux

Posted on 2010-09-15
4
2,115 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 500 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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Suggested Solutions

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

856 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