C
C#2y 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);
}
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.
3 Replies
mtreit
mtreit2y ago
Hard to say without more information. Could easily be some kind of DDoS prevention if the hosts share networking infrastructure.
Kein
KeinOP2y ago
I'm somewhat mimicking existing app that does the same, and it yields close to perfect results. I offloaded Ping to async version and situation became a bit better but I still get 5-6 timeouts on average. If I ping said hosts immediately after that they responsed 100%
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server