How do I get list of IP addresses for devices connected to my same subnet using Java?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
this should work when the hosts on your network react to ICMP packages (ping) (>JDK 5):
invoke the method for a subnet (192.168.0.1-254) like this:
didnt test it but should work kinda like this. Obviously this only checks the 254 hosts in the last byte of the ip address…
check:
http://download-llnw.oracle.com/javase/6/docs/api/java/net/InetAddress.html#isReachable%28int%29
http://blog.taragana.com/index.php/archive/how-to-do-icmp-ping-in-java-jdk-15-and-above/
hope that helped