문제

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