Calculate download speeds/packet loss /jitter /latency to servers on all the continents values (Android)

StackOverflow https://stackoverflow.com/questions/21255416

Вопрос

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.

Это было полезно?

Решение

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 ;                    
             }`
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top