public abstract class NetworkSession
extends java.lang.Object
Base class for client network sessions.
Constructor and Description |
---|
NetworkSession(java.lang.String protoName)
Class constructor
|
Modifier and Type | Method and Description |
---|---|
abstract void |
Close()
Close the network session
|
static int |
getDefaultTimeout()
Return the default socket timeout value
|
java.lang.String |
getProtocolName()
Return the protocol name
|
int |
getTimeout()
Return the send/receive timeout, in milliseconds
|
abstract boolean |
hasData()
Check if the network session has data available
|
abstract boolean |
isConnected()
Determine if the session is connected to a remote host
|
abstract void |
Open(java.lang.String toName,
java.lang.String fromName,
java.lang.String toAddr)
Open a connection to a remote host
|
abstract int |
Receive(byte[] buf)
Receive a data packet from the remote host.
|
abstract boolean |
Send(byte[] data,
int siz)
Send a data packet to the remote host.
|
static void |
setDefaultTimeout(int tmo)
Set the default socket timeout for new sessions
|
void |
setTimeout(int tmo)
Set the send/receive timeout, in milliseconds
|
public NetworkSession(java.lang.String protoName)
protoName
- Stringpublic final java.lang.String getProtocolName()
public abstract void Open(java.lang.String toName, java.lang.String fromName, java.lang.String toAddr) throws java.io.IOException, java.net.UnknownHostException
toName
- Host name/address being calledfromName
- Local host name/addresstoAddr
- Optional address of the remote hostjava.io.IOException
java.net.UnknownHostException
public abstract boolean isConnected()
public abstract boolean hasData() throws java.io.IOException
java.io.IOException
public final int getTimeout()
public abstract int Receive(byte[] buf) throws java.io.IOException
buf
- Byte buffer to receive the data into.java.io.IOException
- I/O error occurred.public abstract boolean Send(byte[] data, int siz) throws java.io.IOException
data
- Byte array containing the data to be sent.siz
- Length of the data to send.java.io.IOException
- I/O error occurred.public abstract void Close() throws java.io.IOException
java.io.IOException
- I/O error occurredpublic void setTimeout(int tmo)
tmo
- intpublic static final int getDefaultTimeout()
public static final void setDefaultTimeout(int tmo)
tmo
- intCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.