My application needs to ping many IP addresses at once for speed of execution of the code. For example, pinging 300 ip addresses that time out after one second would take 5 minutes, whereas if 20 are run at a time, it only will take about 15 seconds.
I have tried calling windows ping.exe for this, but I have had two separate and similar issues with that. One issue is that on some windows machines, ping will just hang for minutes for seemingly no reason until I kill the thread and it dies. The other issue, we've had ping.exe completely break on machines before, where any ping.exe call lasts forever, so hundreds of ping.exe processes start piling up until the machine crashes, and running ping.exe manually from the command line in that case just leaves another ping process hung forever.
I have tried using a library called icmp4j, but that library only allows one ping at a time to happen on Windows.
I tried this person's code and ended up running into issues on my local network. When pinging a local address that didn't exist (on your subnet), apparently you can get a reply that says that the address is unreachable. On exactly 50% of those replies, I would get a timeout, and on the other 50% I would get 'unpingable.'
Does anyone know a method for running many pings on windows at the same time without using icmp4j or ping.exe?