要查看有关ppp连接的一些详细信息,可以运行以下命令:
$ ifconfig ppp
ppp0 Link encap:Point-to-Point Protocol
inet addr:197.108.58.82 P-t-P:10.64.64.64 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:479 errors:0 dropped:0 overruns:0 frame:0
TX packets:479 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:68118 (68.1 KB) TX bytes:32771 (32.7 KB)
为了检查是否有任何数据传输,可以重新运行该命令,同时注意RX packets和TX packets以查看是否有变化(可能有更好的方法来执行此操作?)。在
无论如何,我也可以用Python做同样的事情,但是它很麻烦(使用子进程,然后解析输出),所以我想知道是否有更好的方法。我很想使用netifaces来实现这一点,但它提供了更有限的信息:
^{pr2}$
您可以在
/proc
中查找数据,如果这比调用ifconfig
更容易的话。在参考号:https://www.kernel.org/doc/Documentation/filesystems/proc.txt
相关问题 更多 >
编程相关推荐