com.jscape.inet.whois

## Class Whois

- java.lang.Object
- - com.jscape.inet.whois.Whois

- All Implemented Interfaces:
    java.io.Serializable

      public class Whois
      extends java.lang.Object
      implements java.io.Serializable

  Implements the basic functionality of a Whois client.

  Example Usage:

       Whois whois = new Whois();
        try
       {
         // attempts to lookup information about domain myserver.com
         String results = whois.query("myserver.com");
         System.out.println(results);
       }
       catch(WhoisException e)
       {
         System.out.println(e);
       }

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Whois()` Creates a new Whois instance.
    `Whois(java.lang.String hostname)` Creates a new Whois instance with hostname of whois server as argument.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearProxySettings()` Clears proxy server values.
    `java.lang.String` | `getHostname()` Gets hostname of Whois server.
    `int` | `getPort()` Gets port of Whois server.
    `int` | `getTimeout()` Gets the timeout for opening a Whois connection.
    `java.lang.String` | `query(java.lang.String command)` Connects to Whois server and performs Whois query.
    `void` | `setHostname(java.lang.String str)` Sets hostname of Whois server.
    `void` | `setPort(int port)` Sets port of Whois server.
    `void` | `setProxyAuthentication(java.lang.String proxyUsername, java.lang.String proxyPassword)` Sets the username and password to use when for authentication with proxy server.
    `void` | `setProxyHost(java.lang.String proxyHostname, int proxyPort)` Sets the proxy hostname and port for this connection.
    `void` | `setProxyType(java.lang.String proxyType)` Sets the proxy type will be used for this connection.
    `void` | `setTimeout(int timeout)` Sets the timeout for opening a Whois connection.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Whois

          public Whois()

      Creates a new Whois instance.

    - #### Whois

          public Whois(java.lang.String hostname)

      Creates a new Whois instance with hostname of whois server as argument. Default whois server hostname is whois.networksolutions.com
      Parameters:
        `hostname` - the hostname of whois server

  - ### Method Detail

    - #### setPort

          public void setPort(int port)

      Sets port of Whois server. Default value is 43.
      Parameters:
        `port` - the port of Whois server

    - #### getPort

          public int getPort()

      Gets port of Whois server. Default value is 43.
      Returns:
        port

    - #### setHostname

          public void setHostname(java.lang.String str)

      Sets hostname of Whois server. Default value is whois.networksolutions.com
      Parameters:
        `str` - the hostname of Whois server

    - #### getHostname

          public java.lang.String getHostname()

      Gets hostname of Whois server. Default value is whois.networksolutions.com
      Returns:
        hostname

    - #### setTimeout

          public void setTimeout(int timeout)

      Sets the timeout for opening a Whois connection. Default of 0ms uses natural timeout of socket.
      Parameters:
        `timeout` - in milliseconds

    - #### getTimeout

          public int getTimeout()

      Gets the timeout for opening a Whois connection. Default of 0ms uses natural timeout of socket.
      Returns:
        timeout in milliseconds

    - #### setProxyAuthentication

          public void setProxyAuthentication(java.lang.String proxyUsername,
                                             java.lang.String proxyPassword)

      Sets the username and password to use when for authentication with proxy server. To clear these settings invoke the `#clearProxySettings` method.
      Parameters:
        `proxyUsername` - the proxy username
        `proxyPassword` - the proxy password
      See Also:
        `clearProxySettings()`

    - #### setProxyHost

          public void setProxyHost(java.lang.String proxyHostname,
                                   int proxyPort)

      Sets the proxy hostname and port for this connection. To clear these settings invoke the `#clearProxySettings` method.
      Parameters:
        `proxyHostname` - the hostname or ip address of the proxy server
        `proxyPort` - the port of the proxy server
      See Also:
        `clearProxySettings()`

    - #### setProxyType

          public void setProxyType(java.lang.String proxyType)

      Sets the proxy type will be used for this connection.
      Parameters:
        `proxyType` - The proxy type. Valid values: HTTP, SOCKS5

    - #### clearProxySettings

          public void clearProxySettings()

      Clears proxy server values.

    - #### query

          public java.lang.String query(java.lang.String command)
                                 throws WhoisException

      Connects to Whois server and performs Whois query.
      Parameters:
        `command` - the domain or command to query
      Returns:
        results of Whois query
      Throws:
        `WhoisException` - if a Whois or I/O error occurs

Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved