Pregunta

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!

¿Fue útil?

Solución

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:

Otros consejos

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top