I am working on a LAN based software, for which I require to detect the range in which systems in the network lies, using Java. The function is required to be similar to "Detect local IP range" in Netscan, a Windows utility software.
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.
If you are wanting the actual local subnet IP range, rather than a list of alive IP addresses in the local subnet, you can use the following code to get the subnet mask size:
That will give you a
shortprimitive with a value of 1-32, probably 24. Then you can useWhich will give you a
byte[]which you will mask against the subnetmaskto give you the local address range in some usable format.Alternatively if you want a list of alive hosts on the local subnet, an arp-scan using JPCap is the method I would use.