~ org.apache.commons.net.whois.WhoisClient
Example:
package javawhoisclient;
import java.io.IOException;
import org.apache.commons.net.whois.WhoisClient;
/**
*
* @web http://java-buddy.blogspot.com/
*/
public class JavaWhoisClient {
public static void main(String[] args) {
WhoisClient whois;
whois = new WhoisClient();
try {
whois.connect(WhoisClient.DEFAULT_HOST);
System.out.println(whois.query("=google.com"));
whois.disconnect();
} catch (IOException e) {
System.err.println("Error I/O exception: " + e.getMessage());
return;
}
}
}
To use WhoisClient class in your program, you have to include library commons-net-3.3 in your code, it can be download here: https://commons.apache.org/proper/commons-net/index.html
This video show how to download and add library commons-net-3.3 to NetBeans IDE.
Next:
- query InterNIC server's whois without WhoisClient class.


No comments:
Post a Comment