Question

I've googled this all over the place, and I'm still at a loss. tcp_diag is supposed to replace /proc/net/tcp, but I can't find a shred of documentation on how to use it. Please tell me how to #include it, and what methods, classes and functions it has. Thanks!

Was it helpful?

Solution

You create a DGRAM socket with domain AF_NETLINK and protocol NETLINK_INET_DIAG. Then you use the netlink protocol to communicate with the kernel and get the information you need.

Further reading:

OTHER TIPS

The tcp_diag kernel module does not supply C or C++ functions to call. It provides its interface by causing certain special "files" like /proc/net/tcp to exist. You can get that information directly by reading that file as an ordinary file, or with an executable tool such as ss or the older netstat.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top