Chirag Thakar
Chirag Thakar

Reputation: 11

Java api to find network nodes

How to find all local network nodes in Java ?

Regards,

Chirag

Upvotes: 1

Views: 1186

Answers (1)

Jigar Joshi
Jigar Joshi

Reputation: 240870

You might be looking for this

public void checkHosts(String subnet){
   int timeout=1000;
   for (int i=1;i<254;i++){
       String host=subnet + "." + i;
       if (InetAddress.getByName(host).isReachable(timeout)){
           System.out.println(host + " is reachable");
       }
   }
}

Upvotes: 1

Related Questions