//package com.nowjava;
import java.net.NetworkInterface;
/** from
NowJava.com**/
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
public class Main {
public static void main(String[] argv) throws Exception {
System.out.println(getNetworkInterfaces());
}
/**
* Returns all network interfaces of this host.
* @return all network interfaces of this host
*/
public static Collection<NetworkInterface> getNetworkInterfaces() {
// get network interfaces
ArrayList<NetworkInterface> result = new ArrayList<NetworkInterface>();
Enumeration<NetworkInterface> ifs = null;
/**
* N o w J a v a . c o m - 时 代 Java 提 供
**/
try {
ifs = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e1) {
throw new IllegalStateException(
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。