src/main/java/org/firepick/IPv4Scanner.java
public static List<InetAddress> localhostNetworkAddresses() 
    throws UnknownHostException, SocketException 
  {
    List<InetAddress> result = new ArrayList<InetAddress>();
    InetAddress localhost = null;
    try {
  //    localhost = InetAddress.getLocalHost();
      throw new UnknownHostException();
    } catch(UnknownHostException ex) {
      logger.debug("localhostNetworkAddresses InetAddress.getLocalHost() failed");
    }
    if (localhost == null || localhost.getHostAddress().startsWith("127")) {
      Enumeration<NetworkInterface> n = NetworkInterface.getNetworkInterfaces();
      while (n.hasMoreElements()) {
	NetworkInterface e = n.nextElement();
	Enumeration<InetAddress> a = e.getInetAddresses();
	while (a.hasMoreElements()) {
	  localhost = a.nextElement();
	  if (localhost.isLoopbackAddress()) {
	    // ignore
	  } else {
	    result.add(localhost);
	  }
	}
      }
    }
    if (result.size() == 0) {
      result.add(localhost);
    }
    return result;
  }
public static List<InetAddress> localhostNetworkAddresses() 
    throws UnknownHostException, SocketException 
  {
    List<InetAddress> result = new ArrayList<InetAddress>();
    InetAddress localhost = null;
    try {
  //    localhost = InetAddress.getLocalHost();
      throw new UnknownHostException();
    } catch(UnknownHostException ex) {
      logger.debug("localhostNetworkAddresses InetAddress.getLocalHost() failed");
    }
    if (localhost == null || localhost.getHostAddress().startsWith("127")) {
      Enumeration<NetworkInterface> n = NetworkInterface.getNetworkInterfaces();
      while (n.hasMoreElements()) {
	NetworkInterface e = n.nextElement();
	Enumeration<InetAddress> a = e.getInetAddresses();
	while (a.hasMoreElements()) {
	  localhost = a.nextElement();
	  if (localhost.isLoopbackAddress()) {
	    // ignore
	  } else {
	    result.add(localhost);
	  }
	}
      }
    }
    if (result.size() == 0) {
      result.add(localhost);
    }
    return result;
  }
public static List < InetAddress > localhostNetworkAddresses ( ) throws UnknownHostException , SocketException { List < InetAddress > result = new ArrayList < InetAddress > ( ) ; InetAddress localhost = null ; try { //    localhost = InetAddress.getLocalHost(); throw new UnknownHostException ( ) ; } catch ( UnknownHostException ex ) { logger . debug ( "localhostNetworkAddresses InetAddress.getLocalHost() failed" ) ; } if ( localhost == null || localhost . getHostAddress ( ) . startsWith ( "127" ) ) { Enumeration < NetworkInterface > n = NetworkInterface . getNetworkInterfaces ( ) ; while ( n . hasMoreElements ( ) ) { NetworkInterface e = n . nextElement ( ) ; Enumeration < InetAddress > a = e . getInetAddresses ( ) ; while ( a . hasMoreElements ( ) ) { localhost = a . nextElement ( ) ; if ( localhost . isLoopbackAddress ( ) ) { // ignore } else { result . add ( localhost ) ; } } } } if ( result . size ( ) == 0 ) { result . add ( localhost ) ; } return result ; }
Return list of InetAddress for localhost that are not loopback addresses
(e.g., 127.0.0.1)

@return address list with size() >= 1
Return list of InetAddress for localhost that are not loopback addresses ( e . g . 127 . 0 . 0 . 1 )