import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.Enumeration;
public class ipfind {
ipfind(){
try{
Enumeration e = NetworkInterface.getNetworkInterfaces();
while(e.hasMoreElements()){
NetworkInterface ni = (NetworkInterface)e.nextElement();
Enumeration e1 = ni.getInetAddresses();
while(e1.hasMoreElements()){
InetAddress inetAddress = (InetAddress)e1.nextElement();
System.out.println(" " + inetAddress.getHostAddress());
}
}
}catch(Exception e){
}
}
public static void main(String args[]){
ipfind ipf = new ipfind();
}
}
No comments:
Post a Comment