public static InetAddress getLocalIp () {
        
        NetworkInterface iFace;
        try {
            iFace = NetworkInterface.getByName(interfaceName);
            if (iFace.isLoopback() || (! iFace.isUp()) ) {
                return null;
            }
        } catch (SocketException e) {
            log.warning("Could not find the interface");
            return null;
        }
        
        for (InterfaceAddress addr : iFace.getInterfaceAddresses()) {
            if (addr == null || addr.getAddress() instanceof Inet6Address) {
                continue;
            } else {
                return addr.getAddress();
            }
            
        }
        return null;
    }