Who Is Lookup In Java Example
Chapter:
Networking
Last Updated:
21-07-2016 11:29:32 UTC
Program:
/* ............... START ............... */
import java.io.IOException;
import java.net.SocketException;
import org.apache.commons.net.whois.WhoisClient;
public class JavaWhoIs {
public static void main(String[] args) {
String domain = "example.com";
StringBuilder sb = new StringBuilder("");
WhoisClient wic = new WhoisClient();
try {
wic.connect(WhoisClient.DEFAULT_HOST);
String whoisData1 = wic.query("=" + domain);
sb.append(whoisData1);
wic.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(sb.toString());
}
}
/* ............... END ............... */
Notes:
-
WHOIS is a query and response protocol that is widely used for querying databases that store the registered users or assignees of an Internet resource, such as a domain name, an IP address block, or an autonomous system, but is also used for a wider range of other information.
Tags
Who Is Lookup, Java