TCP_INFO
A mechanism in the Linux kernel for accessing information about a TCP socket. It has been supported since Linux 2.4.
The interface uses the getsockopt()
system call with the TCP_INFO
option on a TCP socket. The system will then fill in a caller-provided struct tcp_info
. The structure is defined in /usr/include/netinet/tcp.h
.
Application Support
ss
The ss
program can be used with the -i
or --info
option to look at this information for active sockets.
This example shows a single active TCP socket, which represents the sending end of an ongoing Iperf TCP test:
State Recv-Q Send-Q Local Address:Port Peer Address:Port ESTAB 0 2796088###0.0.0.247:36868 ###0.0.0.248:5001 cubic wscale:7,7 rto:204 rtt:7.5/3 mss:1448 cwnd:414 ssthresh:388 send 639.4Mbps unacked:401 retrans:0/772 reordering:127 rcv_space:29200
(Note: In my tests, the send rate displayed by ss
was always about 50% lower than what iperf
reported.)
The socket on the receiving side looks like this:
State Recv-Q Send-Q Local Address:Port Peer Address:Port ESTAB 0 0 ####0.0.0.248:5001####0.0.0.247:36868 cubic wscale:7,7 rto:204 rtt:4/2 ato:40 mss:1448 cwnd:10 send 29.0Mbps rcv_rtt:7.5 rcv_space:1826680
iperf
Recent versions of iperf can use TCP_INFO
to extract detailed statistics from an ongoing TCP measurement.
References
- Measuring TCP Congestion Windows, René Pfeiffer, Linux Gazette, March 2007
– Main.SimonLeinen - 2014-12-26