| java.lang.Object org.apache.commons.net.SocketClient org.apache.commons.net.FingerClient org.apache.commons.net.WhoisClient
WhoisClient | final public class WhoisClient extends FingerClient (Code) | | The WhoisClient class implements the client side of the Internet Whois
Protocol defined in RFC 954. To query a host you create a
WhoisClient instance, connect to the host, query the host, and finally
disconnect from the host. If the whois service you want to query is on
a non-standard port, connect to the host at that port.
Here's a sample use:
WhoisClient whois;
whois = new WhoisClient();
try {
whois.connect(WhoisClient.DEFAULT_HOST);
System.out.println(whois.query("foobar"));
whois.disconnect();
} catch(IOException e) {
System.err.println("Error I/O exception: " + e.getMessage());
return;
}
author: Daniel F. Savarese |
Constructor Summary | |
public | WhoisClient() The default whois constructor. |
Method Summary | |
public InputStream | getInputStream(String handle) Queries the connected whois server for information regarding
the given handle and returns the InputStream of the network connection.
It is up to the programmer to be familiar with the handle syntax
of the whois server. | public String | query(String handle) Queries the connected whois server for information regarding
the given handle. |
DEFAULT_HOST | final public static String DEFAULT_HOST(Code) | | The default whois host to query. It is set to whois.internic.net.
|
DEFAULT_PORT | final public static int DEFAULT_PORT(Code) | | The default whois port. It is set to 43 according to RFC 954.
|
WhoisClient | public WhoisClient()(Code) | | The default whois constructor. Initializes the
default port to DEFAULT_PORT .
|
getInputStream | public InputStream getInputStream(String handle) throws IOException(Code) | | Queries the connected whois server for information regarding
the given handle and returns the InputStream of the network connection.
It is up to the programmer to be familiar with the handle syntax
of the whois server. You must first connect to a finger server before
calling this method, and you should disconnect after finishing reading
the stream.
Parameters: handle - The handle to lookup. The InputStream of the network connection of the whois query.Can be read to obtain whois results. exception: IOException - If an I/O error occurs during the operation. |
query | public String query(String handle) throws IOException(Code) | | Queries the connected whois server for information regarding
the given handle. It is up to the programmer to be familiar with the
handle syntax of the whois server. You must first connect to a whois
server before calling this method, and you should disconnect afterward.
Parameters: handle - The handle to lookup. The result of the whois query. exception: IOException - If an I/O error occurs during the operation. |
Fields inherited from org.apache.commons.net.FingerClient | final public static int DEFAULT_PORT(Code)(Java Doc)
|
Methods inherited from org.apache.commons.net.SocketClient | protected void _connectAction_() throws IOException(Code)(Java Doc) public void connect(InetAddress host, int port) throws SocketException, IOException(Code)(Java Doc) public void connect(String hostname, int port) throws SocketException, IOException(Code)(Java Doc) public void connect(InetAddress host, int port, InetAddress localAddr, int localPort) throws SocketException, IOException(Code)(Java Doc) public void connect(String hostname, int port, InetAddress localAddr, int localPort) throws SocketException, IOException(Code)(Java Doc) public void connect(InetAddress host) throws SocketException, IOException(Code)(Java Doc) public void connect(String hostname) throws SocketException, IOException(Code)(Java Doc) public void disconnect() throws IOException(Code)(Java Doc) public int getDefaultPort()(Code)(Java Doc) public int getDefaultTimeout()(Code)(Java Doc) public InetAddress getLocalAddress()(Code)(Java Doc) public int getLocalPort()(Code)(Java Doc) public InetAddress getRemoteAddress()(Code)(Java Doc) public int getRemotePort()(Code)(Java Doc) public int getSoLinger() throws SocketException(Code)(Java Doc) public int getSoTimeout() throws SocketException(Code)(Java Doc) public boolean getTcpNoDelay() throws SocketException(Code)(Java Doc) public boolean isConnected()(Code)(Java Doc) public void setDefaultPort(int port)(Code)(Java Doc) public void setDefaultTimeout(int timeout)(Code)(Java Doc) public void setSoLinger(boolean on, int val) throws SocketException(Code)(Java Doc) public void setSoTimeout(int timeout) throws SocketException(Code)(Java Doc) public void setSocketFactory(SocketFactory factory)(Code)(Java Doc) public void setTcpNoDelay(boolean on) throws SocketException(Code)(Java Doc) public boolean verifyRemote(Socket socket)(Code)(Java Doc)
|
|
|