问题描述
在Linux中,netstat命令告诉我们系统中活动套接字的信息.
In linux, netstat command tells us information of active sockets in system.
我了解到netstat
使用/proc/net/tcp
来获取系统网络信息.
I understand that netstat
uses /proc/net/tcp
to acquire the system network information.
因为netstat
手册页说netstat已过时,所以我们应该使用'ss'.
Since netstat
man page says that netstat is obsolete, so we should use 'ss'.
NOTE
This program is obsolete. Replacement for netstat is ss. Replacement
for netstat -r is ip route. Replacement for netstat -i is ip -s link.
Replacement for netstat -g is ip maddr.
我发现ss
执行类似的功能,但未使用/proc/net/tcp
获取系统网络信息.
I have discovered that ss
performs similar functionality but it does not use/proc/net/tcp
to acquire system network information.
现在我很好奇ss
如何获取系统网络套接字信息?
Now I am curious how ss
gets system network socket information?
推荐答案
它直接使用 Netlink 从内核空间获取它们使用经典的套接字 API.
It gets them from kernel space directly using Netlink which uses the classic sockets API.
这篇关于netstat和ss在linux之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!