Here you can find the source of getLoopbackNIF()
null
if not found.
public static NetworkInterface getLoopbackNIF()
//package com.java2s; /*/* w w w. j av a 2 s .c o m*/ * Copyright (c) 2004 by Cosylab * * The full license specifying the redistribution, modification, usage and other * rights and obligations is included with the distribution of this project in * the file "LICENSE-CAJ". If the license is not included visit Cosylab web site, * <http://www.cosylab.com>. * * THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND, NOT EVEN THE * IMPLIED WARRANTY OF MERCHANTABILITY. THE AUTHOR OF THIS SOFTWARE, ASSUMES * _NO_ RESPONSIBILITY FOR ANY CONSEQUENCE RESULTING FROM THE USE, MODIFICATION, * OR REDISTRIBUTION OF THIS SOFTWARE. */ import java.net.NetworkInterface; import java.net.SocketException; import java.util.Enumeration; public class Main { /** * Get a loopback NIF. * @return a loopback NIF, <code>null</code> if not found. */ // TODO support case with multiple loopback NIFs public static NetworkInterface getLoopbackNIF() { Enumeration<NetworkInterface> nets; try { nets = NetworkInterface.getNetworkInterfaces(); } catch (SocketException se) { return null; } while (nets.hasMoreElements()) { NetworkInterface net = nets.nextElement(); try { if (net.isUp() && net.isLoopback()) return net; } catch (Throwable th) { // some methods throw exceptions, some return null (and they shouldn't) // noop, skip that interface } } return null; } }