public static Collection < InetAddress > getAllByName ( String host , boolean allowIPv6 ) { Enumeration < NetworkInterface > networkInterfaces = cloneInterfaces ( ResolutionUtils . networkInterfaces ) ; List < String > resolvedAddresses = resolveDeviceAddress ( host , networkInterfaces , allowIPv6 ) ; List < InetAddress > resolvedDeviceURIs = new ArrayList <> ( ) ; List < InetAddress > resolvedHosts = resolvedDeviceURIs ; for ( String resolvedAddress : resolvedAddresses ) { try { resolvedHosts . addAll ( asList ( InetAddress . getAllByName ( resolvedAddress ) ) ) ; } catch ( UnknownHostException e ) { e . printStackTrace ( ) ; } } return resolvedHosts ; }
Method resolving host to InetAddresses