Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an application that I'm testing/debugging I would like to know if the connections that it's opening have had the TCP_NODELAY set. Is there are a way to do this e.g. using netstat to look at the details of an open connection? Is something like strace or system tap my best option?

share|improve this question
I'd use tcpdump – user130370 Jan 24 '13 at 8:25
AFAIK tcpdump only captures the data. TCP_NODELAY is a connection option that you set on your code, not an option that you can find on the packets being sent. – drcelus Jan 24 '13 at 8:27
up vote 3 down vote accepted

Sadly you can't after the socket has already been opened. The information linux kernel hands out lacks this information.


You can trace your code via strace and look for lines similar to this (taken from stracing mysql client connecting to a mysql server)

fcntl(3, F_SETFL, O_RDONLY)             = 0
fcntl(3, F_GETFL)                       = 0x2 (flags O_RDWR)
connect(3, {sa_family=AF_INET, sin_port=htons(9000), sin_addr=inet_addr("")}, 16) = 0
setsockopt(3, SOL_SOCKET, SO_RCVTIMEO, "\2003\341\1\0\0\0\0\0\0\0\0\0\0\0\0", 16) = 0
setsockopt(3, SOL_SOCKET, SO_SNDTIMEO, "\2003\341\1\0\0\0\0\0\0\0\0\0\0\0\0", 16) = 0
setsockopt(3, SOL_IP, IP_TOS, [8], 4)   = 0
setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0

If you're on a BSD or non-linux unixy system

lsof -a -p PID -i 4 -T f

could work ( See this similar question ).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.