title: How can I send multiple pings at once using Java on Windows without using ping.exe?
body: <p>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. </p>
  
  <p>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. </p>
  
  <p>I have tried using a library called <a href="https://sourceforge.net/projects/icmp4j/" rel="nofollow noreferrer">icmp4j</a>, but that library only allows one ping at a time to happen on Windows. </p>
  
  <p>I tried this <a href="https://stackoverflow.com/questions/19039646/odd-inetaddress-isreachable-issue/19383757#19383757">person's code</a> 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.' </p>
  
  <p>Does anyone know a method for running many pings on windows at the same time without using icmp4j or ping.exe? </p>