Here you can find the source of getLocalIPList()
public static List<InetAddress> getLocalIPList() throws SocketException, UnknownHostException
//package com.java2s; //License from project: LGPL import java.net.Inet4Address; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.List; public class Main { public static List<InetAddress> getLocalIPList() throws SocketException, UnknownHostException { List<InetAddress> result = new ArrayList<InetAddress>(); Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface net : Collections.list(nets)) { if (!net.isLoopback() && !net.isVirtual() && !net.isPointToPoint() && net.isUp()) { for (InetAddress curAddress : Collections.list(net.getInetAddresses())) { if (curAddress != null && !curAddress.isMulticastAddress() && curAddress instanceof Inet4Address) { result.add(curAddress); }/* ww w . j av a 2s .c o m*/ } } } // Add the loopback address at the end result.add(InetAddress.getLocalHost()); return result; } }