Mega Code Archive

 
Categories / Java / Network Protocol
 

List Network Interfaces

import java.net.NetworkInterface; import java.util.Enumeration; public class Main {   static public void main(String args[]) throws Exception {     Enumeration interfaces = NetworkInterface.getNetworkInterfaces();     while (interfaces.hasMoreElements()) {       NetworkInterface ni = (NetworkInterface) interfaces.nextElement();       System.out.println(ni);     }   } }