whois class?
4 posts in topic
Flat View  Flat View

Posted By:   Wayne_Wylupski
Posted On:   Thursday, December 13, 2001 02:39 PM

Is there a "whois" implementation in Java available? It doesn't seem to be part of the core networking libraries.

I would prefer one that allows the developer to pull out specific data, such as Primary and Secondary name servers, Administrative Contact, etc.

Re: whois class?

Posted By:   Anonymous  
Posted On:   Thursday, January 7, 2010 07:31 AM

Hi, I have found a great site with lots of useful information for programmers & developers of all kinds.

Re: whois class?

Posted By:   Anthony_Eden  
Posted On:   Friday, January 25, 2002 09:03 AM

I have developed code which provides this type of facility but it is internal to my company. The problem is a bit complex since WHOIS data can be formatted differently by each Registrar. Connecting to the WHOIS server and retrieving the data blob is the easy part (as you have seen from the other suggestions).

One more thing: accessing WHOIS information using an automated process is prohibited by most Registrars. Finally some registrars (Network Solutions for example) actually block access to their WHOIS server after a certain number of requests from a particular IP address. Just something to consider.

Re: whois class?

Posted By:   Luigi_Viggiano  
Posted On:   Tuesday, January 1, 2002 04:08 PM

Try this:

import java.net.*;
import java.io.*;

public class Whois {
static final int WHOIS_PORT = 43;
static final String WHOIS_SERVER_NAME = "whois.internic.net";
static final String QUERY = "jguru.com

public static void main(String[] args) {
try {
byte[] queryBytes = QUERY.getBytes();
InetAddress whoisServer = InetAddress.getByName(WHOIS_SERVER_NAME);
Socket whoisSocket = new Socket(whoisServer, WHOIS_PORT);
InputStream reciever = whoisSocket.getInputStream();
OutputStream sender = whoisSocket.getOutputStream();


byte[] b = new byte[1024];
int length = 0;

while ((length = reciever.read(b)) != -1) {
System.out.write(b, 0, length);

} catch (UnknownHostException e) {
System.out.println("Unknown host: " + WHOIS_SERVER_NAME);
} catch (IOException e) {
System.out.println("Network error: " + e.getMessage());

Re: whois class?

Posted By:   Dermot_Hennessy  
Posted On:   Thursday, December 13, 2001 03:12 PM

There appears to be a client from GeekTools which appears in a listing from www.jars.com - have a look there and see if it has what you need...


About | Sitemap | Contact