Java Network Interface Get getLocalInterfaces()

Here you can find the source of getLocalInterfaces()

Description

Return the set of network interfaces for the local host.

License

Open Source License

Exception

Parameter Description
SocketException if an error occurs getting the interface list.

Return

an enumeration of the interfaces or null otherwise.

Declaration

public static Enumeration<NetworkInterface> getLocalInterfaces() throws SocketException 

Method Source Code

//package com.java2s;
/*/*from  ww w.  j  av  a 2s.c o  m*/
 * (C) Copyright IBM Corp. 2011
 *
 * LICENSE: Eclipse Public License v1.0
 * http://www.eclipse.org/legal/epl-v10.html
 */

import java.net.NetworkInterface;
import java.net.SocketException;

import java.util.Enumeration;

public class Main {
    /**
     * Return the set of network interfaces for the local host.
     * 
     * @return an enumeration of the interfaces or null otherwise.
     * @throws SocketException if an error occurs getting the interface list.
     */
    public static Enumeration<NetworkInterface> getLocalInterfaces() throws SocketException {
        return NetworkInterface.getNetworkInterfaces();
    }
}

Related

  1. getInterfaces()
  2. getInterfaces()
  3. getInterfaces(final String interfaceName)
  4. getKey()
  5. getLinkLocalScopeId()
  6. getLocalMac()
  7. getLocalNetworkInterface()
  8. getLoopbackInterface()
  9. getLoopbackInterfaceName()