I need to find out the socket options that an executing client program has set while opening TCP connections to a server. The client is running on Linux. Is it available under /proc/tcp?
I needed to do this too.
lsof doesn't help much as the tcp options aren't exposed in /proc/ as standard.
I used this kernel module https://github.com/veithen/knetstat which I modified to work with older kernel versions as well here: https://github.com/abligh/knetstat
This lets you do:
# cat /proc/net/tcpstat | head
Recv-Q Send-Q Local Address Foreign Address Stat Diag Options
0 0 0.0.0.0:16013 0.0.0.0:* LSTN SO_REUSEADDR=0,SO_KEEPALIVE=0,TCP_NODELAY=0
0 0 127.0.0.1:25 0.0.0.0:* LSTN SO_REUSEADDR=1,SO_KEEPALIVE=1,TCP_NODELAY=0
0 0 0.0.0.0:111 0.0.0.0:* LSTN SO_REUSEADDR=1,SO_KEEPALIVE=0,TCP_NODELAY=0
0 0 0.0.0.0:4643 0.0.0.0:* LSTN SO_REUSEADDR=1,SO_KEEPALIVE=0,TCP_NODELAY=0
0 0 127.0.0.1:753 0.0.0.0:* LSTN SO_REUSEADDR=1,SO_KEEPALIVE=0,TCP_NODELAY=0
0 0 127.0.0.1:113 0.0.0.0:* LSTN SO_REUSEADDR=1,SO_KEEPALIVE=0,TCP_NODELAY=0
0 0 127.0.0.1:754 0.0.0.0:* LSTN SO_REUSEADDR=1,SO_KEEPALIVE=0,TCP_NODELAY=0
0 0 127.0.0.1:1234 0.0.0.0:* LSTN SO_REUSEADDR=1,SO_KEEPALIVE=0,TCP_NODELAY=0
0 0 0.0.0.0:53618 0.0.0.0:* LSTN SO_REUSEADDR=0,SO_KEEPALIVE=0,TCP_NODELAY=0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With