Page 1 of 1

Bypass the 500/1000ms problem of Ping

Posted: 02 May 2014 18:23
by einstein1969
Hi,

I have found a trick for produce an heartbeat with PING with low cpu usage. (this is a proof of concepts).

You can play with the value 22 and 23 for achieve more smoothness and higher precision and tune for your system (I think it's possible make a autotuning mechanism)

This can supply with the lack of precision of ping.

This is code for "command line":

Code: Select all

C:\> cmd /v:on /c" for /L %n in (1,0,1) do @( for /L %i in (1,1,22) do @(ping -n 2 127.0.0.1 >nul) & start "PING" /B ping 127.0.0.1 -n 23 ) & echo  !time! - 128 & title !time! "  | find /N "128"


After a while the process becomes quite stable.

The algorithm uses the law of large numbers and instead of using the strengths, it use the weaknesses of the mechanism to his advantage.

Ref.

This is a variant for controlling delay step:

Code: Select all

C:\> cmd /q /v:on /c" for /L %n in (1,0,1) do ( for /L %i in (1,1,8) do (ping -n 2 127.0.0.1 >nul) ) & start "PING" /B ping 127.0.0.1 -n 33 & echo  !time! - 128 & title !time! "  | find /N "128"


EDIT: Added a second method for controlling delay step

einstein1969