Implementing Traceroute in Android

This is the first time I ask any question, so forgive me for my mistake.

I want to implement traceroute features similar to those apps available in the Android game store.

Visual tracertpro

Traceroute

I know that when you enter CMD in windows traceroute google.com, all the used intermediate IP address will be displayed.

Now that I have tried.

I am trying to use a command traceroute, but android does not support tracerouteonly the root device that supports it.

Process process =Runtime.getRuntime().exec("traceroute yahoo.com");
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
int i;
char[] buffer = new char[4096];
StringBuffer output = new StringBuffer();
while ((i = reader.read(buffer)) > 0)
    output.append(buffer, 0, i);
reader.close();
Log.d("*************", ""+output);

So, I decided to use the ping command, but could not succeed. Using the ping command, it does not provide google.com ip the way I need it, and over application displays.

Process process = Runtime.getRuntime().exec("/system/bin/ping -t 1 -c 1 google.com");

BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
int i;
char[] buffer = new char[4096];
StringBuffer output = new StringBuffer();
while ((i = reader.read(buffer)) > 0)
    output.append(buffer, 0, i);
reader.close();
Log.d("*************", ""+output);

Please, please, how to do this. Some link or some tutorial will be very helpful.

.

+5
2
+4

Traceroute , 3 ICMP UDP , TTL 1 (max 1 hop). , , ( 11 ICMP 11), , IP-, MTU . . traceroute , , TTL , , , .

, TTL . , TTL.

+1

All Articles