Monday 15 June 2015

networking - How can I find all locally bound IP addresses in Java? -


I have an array of locally bound IP addresses, basically java.net.InetAddress. I know that I can call InetAddress.getAllByName () with the host name, but I was wondering if there is another direct method in which the knowledge of the DNS and / or host name is not included.

java.net.NetworkInterface.getNetworkInterfaces () An enumeration will allow you to invite getInetAddresses () on each network interface to get the addresses associated with this interface.


No comments:

Post a Comment