public static String getLocalIp() throws SocketException

{	Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();

    while (interfaces.hasMoreElements()){
    	NetworkInterface current = interfaces.nextElement();
    	System.out.println(current);
    	if (!current.isUp() || current.isLoopback() || current.isVirtual()) continue;
    		Enumeration<InetAddress> addresses = current.getInetAddresses();
    		while (addresses.hasMoreElements()){
    			InetAddress current_addr = addresses.nextElement();
    			if (current_addr.isLoopbackAddress()) continue;
    			if (current_addr instanceof Inet4Address)
    				  return current_addr.getHostAddress();
    }
}
    return "-1";

}