Question

I need to calculate the following:

  • upload,
  • download speed
  • packet loss
  • jitter
  • latency to servers on all the continents
  • locally and details about mobile carriers

Could someone please tell me what is the best way to track these things?

I need accuracy to be high.

Was it helpful?

Solution

please find the code to get latency.and mark it as solution if it solve your problem ,so that it helps the other to find the answer.

public String getLatency()
         {
            String latency ="";
                    String ip = "ip address of the server";
                    String pingCmd = "ping -c 25 " + ip;
                    try {
                        Runtime r = Runtime.getRuntime();
                        Process p = r.exec(pingCmd);
                        BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
                        String inputLine;
                        String latencyResult = null;
                        while ((inputLine = in.readLine()) != null)
                        {
                            latencyResult = inputLine;
                        }
                        String[] keyValue = latencyResult.split("=");
                        String[] value = keyValue[1].split("/");
                        latency = value[1];                  
                    }
                    catch (Exception e)
                    {
                      LogWrite.d(TAG, "Exception..."+e);
                    }
            return latency ;                    
             }`
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top