Menampilkan IP Komputer



//Ditulis : Wahyudin
//Tanggal : 8 April 2009
//=======================
import java.net.*;
import java.io.*;
import java.util.*;

class DisplayNIC
{
public static void main(String[] args) throws Exception
{
Enumeration e = NetworkInterface.getNetworkInterfaces();
while (e.hasMoreElements())
{
NetworkInterface n = (NetworkInterface)
e.nextElement();
System.out.print ("NIC : "+n.getName()+" ");
Enumeration e1 = n.getInetAddresses();
while (e1.hasMoreElements())
{
InetAddress i = (InetAddress) e1.nextElement();
System.out.println ("Alamat IP : "+ i.toString());
}
}
}
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s