Solved

How do I change TCP_NODELAY in Linux

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now