socket_getLocalHost.htm

import java.io.*;
//import java.util.*;
import java.net.*;
class Test_this {
public static void main(String args[])throws IOException
{
//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//System.out.println("-->Welcome to socket building<--");
//System.out.print("type host name");
//String str = br.readLine();
process_this pt = new process_this();
pt.method_socket_address();

}
}
class process_this
{
//public String str = "http://manas6/";
public void method_socket_address()throws IOException
{
InetAddress address = InetAddress.getLocalHost();
System.out.println("Host is : "+ address);
}
}

 

import java.io.*;
//import java.util.*;
import java.net.*;
class Test_this {
public static void main(String args[])throws IOException
{
//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//System.out.println("-->Welcome to socket building<--");
//System.out.print("type host name");
//String str = br.readLine();
process_this pt = new process_this();
pt.method_socket_address();

}
}
class process_this
{
//public String str = "http://manas6/";
public void method_socket_address()throws IOException
{
InetAddress address = InetAddress.getLocalHost();
System.out.println("Host is : "+ address);
System.out.println("Host name : "+ address.getHostName());
System.out.println("Host IP : "+ address.getHostAddress());
}
}