Enterprise Information Portal APIs

com.ibm.gcs.netutil
Class NetworkClient

java.lang.Object
  |
  +--com.ibm.gcs.netutil.NetworkClient
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
NntpClient

public abstract class NetworkClient
extends java.lang.Object
implements java.io.Serializable

This class implements that basic intefaces of transfer protocols. It is used by subclasses implementing specific protocols. This is an abstract class, so it has to have derivations.

See Also:
NntpClient, Serialized Form

Constructor Summary
NetworkClient()
           
NetworkClient(java.lang.String host, int port, boolean connect)
          Create a new NetworkClient.
 
Method Summary
 NetworkClientReply connect()
          connect a disconnected client
 NetworkClientReply disconnect()
          Disconnect from the server.
 java.lang.String getHost()
           
 int getPort()
           
 boolean isConnected()
          check if the client is already connected
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetworkClient

public NetworkClient()

NetworkClient

public NetworkClient(java.lang.String host,
                     int port,
                     boolean connect)
              throws java.net.UnknownHostException,
                     java.io.IOException
Create a new NetworkClient.
Parameters:
hostName - - the hostname
port - - the port
connect - - whether to start the client connected or not
Throws:
java.net.UnknownHostException - - Socket could not be opened with specified host
java.io.IOException - - DataOutputStream and/or BufferedReader could not be created
Method Detail

connect

public NetworkClientReply connect()
                           throws java.net.UnknownHostException,
                                  java.io.IOException
connect a disconnected client
Returns:
NetworkClientReply - a reply object that represents the status of connection
Throws:
java.net.UnknownHostException - - Socket could not be opened with specified host
java.io.IOException - - DataOutputStream and/or BufferedReader could not be created

isConnected

public boolean isConnected()
check if the client is already connected
Returns:
boolean - true if connnected, false otherwise

disconnect

public NetworkClientReply disconnect()
                              throws java.io.IOException
Disconnect from the server.
Returns:
NetworkClientReply - reply object as a result of the disconnect request
Throws:
java.io.IOException - - could not send 'quit' command

getHost

public java.lang.String getHost()

getPort

public int getPort()

EIP Web Crawler APIs

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.