Free Academic Seminars And Projects Reports

Full Version: Inet Demo Java source code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
import java.net.*;
import java.io.*;

class InetDemo2
{
byte buff[];
InetAddress idr;
String addrmsg;
InetDemo2() throws UnknownHostException
{
buff=new byte[4];
idr=InetAddress.getLocalHost();
buff=idr.getAddress();
addrmsg=idr.getHostName()+"/";
}
public String toString()
{
for(int i=0;i<buff.length;i++)
addrmsg+=(buff[i] & 255) + ".";
return "The Local Host Address is"+addrmsg;
}
public static void main(String args[])throws UnknownHostException
{
InetDemo2 d =new InetDemo2();
System.out.println(d);
}


}