0

When pinging 8.8.8.8 from mono System.Net.NetworkInformation.Ping reply time is very higher than pinging from Lava.Lang.Process ex. ping -c 10 8.8.8.8

PingReply Reply = await pingo.SendPingAsync(text_ip.Text, 4000);
        Toast.MakeText(Activity, Reply.Status.ToString(), ToastLength.Long).Show();
        switch (Reply.Status)
        {
            case IPStatus.Success:

                Toast.MakeText(Activity, Reply.Status.RoundTripTime().ToString(), ToastLength.Long).Show();
                break;

if here is estimate ex. 100 ms

in this other example it shows lower ex. 60 ms.

Process ipProcess = runtime.exec("ping -c 1 8.8.8.8");
    int exitValue = ipProcess.waitFor();
    ipProcess.destroy();

    if(exitValue == 0)
    {
        // Success
    } 
       else 
    { 
         // Failure
    }

Why is this happening and can be solved or is problem with mono implementation ?

EAK TEAM
  • 5,726
  • 4
  • 30
  • 52
  • Is it possible that it's nearly twice the time regardless of the "pinged" system? – Psi Mar 19 '17 at 14:27
  • yes , if i understand what you mean , it almost twice the time ... but not always , sometimes it just make the time higher about `40 - 60 %` more than pinging from `exec` – EAK TEAM Mar 19 '17 at 14:30
  • I'm just reading some documentation, my suspicion is, that `ping` divides the total time by 2 to show the time for one way while mono doesn't do that... – Psi Mar 19 '17 at 14:34
  • 1
    OK what I found is http://serverfault.com/questions/438475/data-obtained-from-ping-is-it-round-trip-or-one-way stating that ping is indeed showing the whole round-trip time. – Psi Mar 19 '17 at 14:36
  • but pinging from `adb shell` gives the same result as pinging from `cmd windows` , only from `mono` it get higher values – EAK TEAM Mar 19 '17 at 14:37
  • wait... I thought we were on android. Are you using a device emulator? – Psi Mar 19 '17 at 14:38
  • i see ... Thanks for that information but do you have any idea how to solve that annoying thing ? :)\ – EAK TEAM Mar 19 '17 at 14:38
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/138461/discussion-between-psi-and-eak-team). – Psi Mar 19 '17 at 14:38
  • i am trying in real android device and from a laptop (windows) in windows and exex from android it shows same but when i use System.Net.NetworkInformation from mono in the same android device it shows higher – EAK TEAM Mar 19 '17 at 14:39
  • @Psi i have a bounty for you , if you aceept :D : http://stackoverflow.com/questions/42905673/how-to-stop-a-process-from-system-diagnostics-process-and-get-the-statistics-in – EAK TEAM Mar 22 '17 at 14:05

0 Answers0