Disable TCP Delayed ACKs

Viewed 34338

I have an application that receives relatively sparse traffic over TCP with no application-level responses. I believe the TCP stack is sending delayed ACKs (based on glancing at a network packet capture). What is the recommended way to disable delayed-ACK in the network stack for a single socket? I've looked at TCP_QUICKACK, but it seems that the stack will change it under my feet anyways.

This is running on a Linux 2.6 kernel, and I am not worried about portability.

3 Answers

The accepted answer has a bug, it should be

flags = 0;
flglen = sizeof(flags);
setsockopt(sfd, SOL_TCP, TCP_QUICKACK, &flags, flglen)

(SOL_TCP, not IPPROTO_TCP)

Post here in case someone need it.

As @damolp suggested, it is not a bug. Keep it here for record.

Related