Here you can find the source of getAllAvailableInterfaces()
public static List<NetworkInterface> getAllAvailableInterfaces() throws SocketException
//package com.java2s; //License from project: Apache License import java.net.NetworkInterface; import java.net.SocketException; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; public class Main { /**/*from www . j a va 2 s .c o m*/ * Returns all the available interfaces, including first level sub * interfaces. */ public static List<NetworkInterface> getAllAvailableInterfaces() throws SocketException { List<NetworkInterface> allInterfaces = new ArrayList<>(); for (Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); interfaces .hasMoreElements();) { NetworkInterface intf = interfaces.nextElement(); allInterfaces.add(intf); Enumeration<NetworkInterface> subInterfaces = intf.getSubInterfaces(); if (subInterfaces != null && subInterfaces.hasMoreElements()) { while (subInterfaces.hasMoreElements()) { allInterfaces.add(subInterfaces.nextElement()); } } } return allInterfaces; } }