在Nexus 7上的网络统计信息 [英] Network statistics on Nexus 7

查看:247
本文介绍了在Nexus 7上的网络统计信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想读我的Nexus 7从文件系统的网络统计数据。在测试前,所有的设备,网络统计数据(例如,tx_packets)总是位于

I want to read the network statistics on my Nexus 7 from the file system. On all devices tested before, the network statistics (e.g., tx_packets) were always located in

/sys/devices/virtual/net/wlan

不过,虽然对的Nexus 7有四个匹配的子目录

However, although on the Nexus 7 there are four matching sub directories

/sys/devices/virtual/net/dummy
/sys/devices/virtual/net/ip6tnl0
/sys/devices/virtual/net/lo
/sys/devices/virtual/net/sit0

他们都不似乎提供正确的统计数据,因为所有的统计文件不会在通过WiFi网络访问更改。

none of them seems to provide the right statistics, as all their statistic files do not change during Web access via WiFi.

任何sugestions,我看起来也?

Any sugestions where I might look as well?

推荐答案

尝试目录:/ SYS /班/网/的 IFACE 的/统计/ tx_packets

try the directory: /sys/class/net/iface/statistics/tx_packets

例如为wlan0

long txPackets= 0; //tx Packets
String cmd="cat /sys/class/net/wlan0/statistics/tx_packets\n";
Process p=null;
BufferedReader in2=null;

try {
    p = Runtime.getRuntime().exec(cmd);
    in2 = new BufferedReader(new InputStreamReader(p.getInputStream()));
    txPackets= Long.parseLong(in2.readLine());  
}catch (Exception e)
{
    // TODO: handle exception
    e.printStackTrace();
}

这篇关于在Nexus 7上的网络统计信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆