how to know how many computers are connected in LAN by using java?
Printable View
how to know how many computers are connected in LAN by using java?
InetAddress localhost=InetAddress.getLocalHost();
byte[] ip=localhost.getAddress();
for(int i=0;i<=50;i++)
{
ip[3]=(byte)i;
InetAddress add=InetAddress.getByAddress(ip);
if(!add.getHostAddress().equals(add.getHostName()) )
System.out.println(add);
}
value of i can vary from 0-255