Here you can find the source of getInterfaces()
Parameter | Description |
---|---|
SocketException | if is not possible to retries network interfaces. |
public static List<NetworkInterface> getInterfaces() throws SocketException
//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); } }