C#C
C#3y ago
Kein

❔ Pinging hundred of hosts sequentially

I'm getting weird inconsistent results:
Ping pingSender = new Ping();
PingOptions options = new PingOptions(128, false);
for (int i = 0; i < data.Count; i++)
{
    var sessRes = data[i];
    var reply = pingSender.Send(sessRes.HostAddress, 1000, filler, options);
    if (reply.Status == IPStatus.Success)
        sessRes.Ping = (uint)reply.RoundtripTime;
    Thread.Sleep(100);
}

I know for a fact that among all the host addresses none of them exceed ping above 300ms and they ALL respond to ICMP yet I'm getting almost half as TimedOut. Any idea what gives? This work already offloaded to separate Task so I dont need async version.
If you know more reliable tools to ping dozens of hosts that would work too.
Was this page helpful?