Implement Traceroute functionality in android

PressRex profile image
by PressRex
Implement Traceroute functionality in android

This is the first time I am asking any question so forgive me for my any mistake.

I want to implement traceroute functionality like this apps available in android play store.

Visual TracertPro

Traceroute

I know that when typing in CMD in windows traceroute google.com will display all intermediate IP used.

Now what I have tried.

I try using traceroute command but android not support traceroute only rooted device support 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 thought to achieve using ping command but couldn't get any success.By using ping command it only gives ip of google.com not as I need and above apps display.

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 guide me how to achieve this. Some link or some tutorial will be very useful.

Thanking you in advance.

Source: View source

PressRex profile image
by PressRex

Subscribe to New Posts

Lorem ultrices malesuada sapien amet pulvinar quis. Feugiat etiam ullamcorper pharetra vitae nibh enim vel.

Success! Now Check Your Email

To complete Subscribe, click the confirmation link in your inbox. If it doesn’t arrive within 3 minutes, check your spam folder.

Ok, Thanks

Read More