Class NetworkInterfaceUtil


  • public class NetworkInterfaceUtil
    extends Object
    Utility class for network interface related functionality.
    • Constructor Detail

      • NetworkInterfaceUtil

        public NetworkInterfaceUtil()
    • Method Detail

      • getFirstIpV4Address

        public Optional<InetAddress> getFirstIpV4Address​(NetworkInterface networkInterface)
        Loops through a network interface's addresses and returns the first one that matches an IPv4 address.
        Parameters:
        networkInterface - the network interface where to seek for an IPv4 address.
        Returns:
        the first found IPv4 address or empty if there is no IPv4 address connected to the network interface.