0

有没有办法监控程序从互联网发送和接收的数据?例如,如果你有一个游戏,它从服务器获取一些信息,因为程序必须被告知这些信息,有没有办法记录和读取它?我读过一些类似的问题,但它们都集中在传输了多少数据上。我知道什么正在传输什么数据

4

3 回答 3

0
extView infoView = (TextView)findViewById(R.id.traffic_info);
String info = "";

info += "Mobile Interface:\n";
info += ("\tReceived: " + TrafficStats.getMobileRxBytes() + " bytes / " + TrafficStats.getMobileRxPackets() + " packets\n");
info += ("\tTransmitted: " + TrafficStats.getMobileTxBytes() + " bytes / " + TrafficStats.getMobileTxPackets() + " packets\n");

info += "All Network Interface:\n";
info += ("\tReceived: " + TrafficStats.getTotalRxBytes() + " bytes / " + TrafficStats.getTotalRxPackets() + " packets\n");
info += ("\tTransmitted: " + TrafficStats.getTotalTxBytes() + " bytes / " + TrafficStats.getTotalTxPackets() + " packets\n");

infoView.setText(info);
于 2012-09-06T06:22:24.720 回答
0

您正在寻找 Fiddler(用于 HTTP 流量)或 Wireshark(用于所有流量)。

于 2012-06-17T17:03:07.990 回答
0
mStartRX = TrafficStats.getTotalRxBytes();

mStartTX = TrafficStats.getTotalTxBytes(); TextView RX = (TextView)findViewById(R.id.RX);

TextView TX = (TextView)findViewById(R.id.TX);

long rxBytes = TrafficStats.getTotalRxBytes()- mStartRX;

RX.setText(Long.toString(rxBytes));

long txBytes = TrafficStats.getTotalTxBytes()- mStartTX;

TX.setText(Long.toString(txBytes));
于 2012-09-06T06:23:58.277 回答