Find WHOIS information of any domain from a JAVA Program

This Java sample program shows how to find the WHOIS information of any website from a Java porgram.

A project for a domain hosting company required to find the WHOIS information of websites. You can also use this to check who is the owner of a website and other details such as the DNS servers for a particular website, the registrar etc..

/*
 *
 * A free Java sample program 
 * to find WHOIS information of any domain
 *
 * free for use as long as this comment is included 
 * in the program as it is
 * 
 * More Free Java programs available for download 
 * at http://www.java-samples.com
 *
 */

import java.io.*;
import java.net.*;
class findwhois{
public static void main(String [] args) throws Exception{
int c;
Socket s=new Socket("internic.net",43);
InputStream in = s.getInputStream();
OutputStream out = s.getOutputStream();
String str=(args.length==0?"m-indya.com":args[0])+"\n";
byte buf[] = str.getBytes();
out.write(buf);
while((c=in.read())!= -1){
	System.out.print((char)c);
}
s.close();
}

}

More Free Java Sample Code