@Override protected String doInBackground(Void... params){
  try {
    String res=launchPing(urlToPing);
    mTraceRouteResult.append(res);
    publishProgress(res);
    TraceRouteContainer trace;
    if (res.contains(UNREACHABLE_PING) && !res.contains(EXCEED_PING)) {
      trace=new TraceRouteContainer("",parseIpFromPing(res),elapsedTime,false);
    }
 else {
      trace=new TraceRouteContainer("",parseIpFromPing(res),ttl == maxTtl ? Float.parseFloat(parseTimeFromPing(res)) : elapsedTime,true);
      InetAddress inetAddr=InetAddress.getByName(trace.getIp());
      Log.e("TAG","getIP is " + trace.getIp());
      String hostname=inetAddr.getHostName();
      String canonicalHostname=inetAddr.getCanonicalHostName();
      trace.setHostname(hostname);
      traces.add(trace);
    }
    return res;
  }
 catch (  final Exception e) {
    e.printStackTrace();
  }
  return "";
}

@ Override protected String doInBackground ( Void ... params ) { try { String res = launchPing ( urlToPing ) ; mTraceRouteResult . append ( res ) ; publishProgress ( res ) ; TraceRouteContainer trace ; if ( res . contains ( UNREACHABLE_PING ) && ! res . contains ( EXCEED_PING ) ) { trace = new TraceRouteContainer ( "" , parseIpFromPing ( res ) , elapsedTime , false ) ; } else { trace = new TraceRouteContainer ( "" , parseIpFromPing ( res ) , ttl == maxTtl ? Float . parseFloat ( parseTimeFromPing ( res ) ) : elapsedTime , true ) ; InetAddress inetAddr = InetAddress . getByName ( trace . getIp ( ) ) ; Log . e ( "TAG" , "getIP is " + trace . getIp ( ) ) ; String hostname = inetAddr . getHostName ( ) ; String canonicalHostname = inetAddr . getCanonicalHostName ( ) ; trace . setHostname ( hostname ) ; traces . add ( trace ) ; } return res ; } catch ( final Exception e ) { e . printStackTrace ( ) ; } return "" ; }
launches the ping , launches inetaddress to retrieve url if there is one , store trace
