Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to tell if two IPs are on the same subnet?

871946Jun 28 2011 — edited Jun 28 2011
Hi,

By a given target host IP, I am working on matching a local IP address in order to appropriately subscribe CIM indication to the target host.

In a way, I need to iterate through all the local IP addresses to match the given IP of the endpoint. The method java.net.InetAddress.isReachable() does not return the reliable. I am thinking to use subnet mask to match the IPs. Any suggestions? Hope both IPv4 and IPv6 can be handled.


Thank you.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 26 2011
Added on Jun 28 2011
1 comment
302 views