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
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 hostnameport
- - the portconnect
- - whether to start the client connected or not- Throws:
java.net.UnknownHostException
- - Socket could not be opened with
specified hostjava.io.IOException
- - DataOutputStream and/or BufferedReader could
not be created
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 hostjava.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()
(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.