I am working on creating a traceroute service for Android, and since Android does not come with a built in traceroute command, I am implementing one using adb shell ping iteratively with increasing TTL values.
This is a sample of the request/response:
//Sample shellCommand: /system/bin/ping -c 1 -t 8
Runtime.getRuntime().exec(shellCommand + DESTINATION_URL);
PING opf-www.google.com (xxx.xxx.xxx.xxx) 56(84) bytes of data.
--- opf-www.google.com ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
I want to know how to decipher "56(84) bytes of data". What is 56 and 84 here?
I want to analyse the amount of data used by traceroute, and am using TrafficStats class to do so:
int UID = myUid(); long mStartRX = TrafficStats.getUidRxBytes(UID); long mStartTX = TrafficStats.getUidTxBytes(UID); new TracerouteTask().run(); long rxBytes = TrafficStats.getUidRxBytes(UID)- mStartRX; long txBytes = TrafficStats.getUidTxBytes(UID)- mStartTX;
Using this, I always receive a value of 0 for rxBytes, i.e no. of bytes received. Why is this the case? We receive an ICMP TTL exceeded packet.