Pergunta

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!

Foi útil?

Solução

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:

Outras dicas

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 em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top