有没有办法监控程序从互联网发送和接收的数据?因此,例如,如果你有一个游戏,它从服务器获取一些信息,因为必须告诉程序信息,是否有记录和阅读它的方法?我已经阅读了几个类似的问题,但他们都关注的是传输了多少数据。我该知道要传输什么数据
答案 0 :(得分:0)
您正在寻找Fiddler(用于HTTP流量)或Wireshark(用于所有流量)。
答案 1 :(得分: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);
答案 2 :(得分: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));