Java Network Interface Get getInterfaces()

Here you can find the source of getInterfaces()

Description

This method returns a List of Network Interfaces on the computer.

License

Open Source License

Exception

Parameter Description
SocketException if is not possible to retries network interfaces.

Return

of on the computer.

Declaration

public static List<NetworkInterface> getInterfaces() throws SocketException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

import java.util.Collections;
import java.util.Enumeration;
import java.util.List;

public class Main {
    /**//from  ww w  .j av  a  2s. co m
     * This method returns a List of Network Interfaces on the computer.
     * @return {@link List} of {@link NetworkInterface} on the computer.
     * @throws SocketException if is not possible to retries network interfaces.
     */
    public static List<NetworkInterface> getInterfaces() throws SocketException {
        Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
        return Collections.list(nets);
    }
}

Related

  1. getInterfaceByName(String interfaceName)
  2. getInterfaceDiagnostic()
  3. getInterfaceInfo(NetworkInterface nif)
  4. getInterfaces()
  5. getInterfaces()
  6. getInterfaces()
  7. getInterfaces()
  8. getInterfaces(final String interfaceName)
  9. getKey()