How can I do a ping every 500 ms?

By default the time delay between two pings is equal to 1 second. My need is to reduce the delay between two pings to 500 ms (0.5 seconds). Is there any way to do this?


Solution 1:

You could create an endless loop in PowerShell, send 1 ping there and wait for 500ms after sending it.

while ($true) { Test-Connection ServerName -Count 1 ; Start-Sleep -MilliSeconds 500 }

You can also Wrap it in a Function and put in in your PowerShell Profile to use it anytime

Function New-Ping {
    
    Param(
        [Parameter(Mandatory)]
        [string]$ComputerName,
        [Parameter(Mandatory)]
        [int]$Intervall
    )

    while ($true) { 
        Test-Connection $ComputerName -Count 1
        Start-Sleep -MilliSeconds $Intervall 
    }
}

and use it like this from within PowerShell:

New-Ping ServerName 500

You can also use it in cmd.exe like so:

C:\WINDOWS\system32>powershell new-ping SRV 500

Source        Destination     IPV4Address      IPV6Address                              Bytes    Time(ms)
------        -----------     -----------      -----------                              -----    --------
CP            SRV            10.0.0.226                                                32       0
CP            SRV            10.0.0.226                                                32       0
CP            SRV            10.0.0.226                                                32       0

You can end the endless loop by pressing CTRL + C

Solution 2:

You can do this with nping (from the makers of nmap)

  1. First download and install the nmap package which includes nping.
  2. In a command prompt change the directory to C:\Program Files (x86)\Nmap
  3. Now run the following command: nping --delay 500ms --count 0 <target ip address>
    (the --count 0 option sets it to a continuous ping)

....from Nping Reference Guide:

Usage: nping [Probe mode] [Options] {target specification}
....
....
TIMING AND PERFORMANCE:
  Options which take <time> are in seconds, or append 'ms' (milliseconds),
  's' (seconds), 'm' (minutes), or 'h' (hours) to the value (e.g. 30m, 0.25h).
  --delay <time>                   : Adjust delay between probes.
  --rate  <rate>                   : Send num packets per second.