문제

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!

도움이 되었습니까?

해결책

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:

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top