socket_getByName.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(str);
}
}
class process_this
{
public String str = "manas6";
public void method_socket_address(String str2)throws IOException
{
InetAddress address = InetAddress.getByName(str);
System.out.println("Networking Host is http:// "+ address);
System.out.println("Host name : "+ address.getHostName());
System.out.println("Host IP : "+ address.getHostAddress());
//
InetAddress address2 = InetAddress.getByName(str2);
System.out.println("Remote server is http:// "+ address2);
System.out.println("Remote server name : "+ address2.getHostName());
System.out.println("Remote server IP : "+ address2.getHostAddress());
}
}