title: Implement Traceroute functionality in android
body: <p>This is the first time I am asking any question so forgive me for my any mistake.</p>
  
  <p>I want to implement traceroute functionality like this apps available in android play store.</p>
  
  <p><a href="https://play.google.com/store/apps/details?id=com.redinput.tracert.pro&amp;hl=en" rel="nofollow">Visual TracertPro</a></p>
  
  <p><a href="https://play.google.com/store/apps/details?id=com.scan.traceroute&amp;hl=en" rel="nofollow">Traceroute</a></p>
  
  <p>I know that when typing in CMD in windows <code>traceroute google.com</code> will display all intermediate IP used.</p>
  
  <p><strong>Now what I have tried.</strong></p>
  
  <p>I try using <code>traceroute</code> command but android not support <code>traceroute</code> only rooted device support it.</p>
  
  <pre><code>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)) &gt; 0)
      output.append(buffer, 0, i);
  reader.close();
  Log.d("*************", ""+output);
  </code></pre>
  
  <p>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.</p>
  
  <pre><code>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)) &gt; 0)
      output.append(buffer, 0, i);
  reader.close();
  Log.d("*************", ""+output);
  </code></pre>
  
  <p>Please guide me how to achieve this. Some link or some tutorial will be very useful.</p>
  
  <p>Thanking you in advance.</p>