This can be done using tcpprobe , which is a module that inserts a hook into the tcp_recv processing path, using kprobe records the status of the TCP connection in response to incoming packets.
Suppose you want to check the tcp connection on port 443, you need to do the following:
sudo modprobe tcp_probe port=443 full=1 sudo chmod 444 /proc/net/tcpprobe cat /proc/net/tcpprobe > /tmp/output.out & pid=$!
full = 1 : enter each ack packet received
full = 0 : register only when the condo changes (if you use this, your output may be empty)
Now pid is the process that registers the probe. To stop, just kill this process:
kill $pid
The format of output.out (according to source on line 198):
[time][src][dst][length][snd_nxt][snd_una][snd_cwnd][ssthresh][snd_wnd][srtt][rcv_wnd]
source share