private List < InetAddress > findAddresses ( ) throws HarvestException { // Stores found addresses List < InetAddress > found = new ArrayList < InetAddress > ( 3 ) ; // Retrieve list of available network interfaces Enumeration < NetworkInterface > interfaces = getNetworkInterfaces ( ) ; while ( interfaces . hasMoreElements ( ) ) { NetworkInterface iface = interfaces . nextElement ( ) ; // Evaluate network interface if ( ! useNetworkInterface ( iface ) ) { continue ; } // Retrieve list of available addresses from the network interface Enumeration < InetAddress > addresses = iface . getInetAddresses ( ) ; while ( addresses . hasMoreElements ( ) ) { InetAddress address = addresses . nextElement ( ) ; // loopback addresses are discarded if ( address . isLoopbackAddress ( ) ) { continue ; } // Ignore IPv6 addresses for now if ( address instanceof Inet4Address ) { found . add ( address ) ; } } } return found ; }
Finds available addresses that will be used to gather candidates from .