0

I am trying to ping a list of computers on LAN network (address stored in a list)

while(listIterator.hasNext())
{
// listIterator.next() will give address for each computer
boolean bool = inetAddress.isReachable(timeout);
}

For each iteration, I am only able to ping only one computer and rest giving false (All computers are up and running on LAN). Can anyone suggest a problem in this or an efficient way to do this?

hoshang.varshney
  • 1,110
  • 3
  • 15
  • 26

1 Answers1

1

Are you running on Linux? If so it will only really work if you are running as root, since sending the "pings" requires root privilege (The real ping command is set up to effectively run as root).

Horrible as it sounds, your best bet might be to spawn off a "ping" command and look at its exit code.

Paul Cager
  • 1,910
  • 14
  • 21