All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.jaw.impl.adaptor.comm.AdaptorSocket
java.lang.Object
|
+----com.sun.jaw.impl.adaptor.comm.AdaptorSocket
- public abstract class AdaptorSocket
- extends Object
- implements Cloneable
The AdaptorSocket class provides a wrap-up of the
socket to be used for HTTP-based adaptors.
-
AdaptorSocket()
-
-
clone()
- Creates a new object of the same class as this object.
-
createClientSocket()
- Create a socket to be used on the client side.
-
createServerSocket(int)
- Create a socket to be used on the server side with the given port
-
doBind()
- Bind to receive requests (usually used on server side)
-
doConnect(String, int)
- Connect to send a request (usually used on client side)
-
doDisconnect()
- Can be used on both server and client sides.
-
doGetInputStream()
- Return an inputstream for this socket.
-
doReceive()
- Wait for an incoming message.
-
doSend(String, byte[])
- Send the given header and content to the peer.
-
doUnbind()
- Unbind (usually used on server side)
-
getLocalAddress()
- Return the local IP address.
-
getLocalPort()
- Return the local port number.
-
getProtocol()
- Return the name of the "protocol" used
-
getRemoteAddress()
- Return the remote IP address.
-
getRemotePort()
- Return the remote port number.
-
getTimeout()
- Returns setting for TIMEOUT.
-
setTimeout(int)
-
Enable/disable TIMEOUT with the specified timeout, in milliseconds.
AdaptorSocket
public AdaptorSocket()
clone
public Object clone()
- Creates a new object of the same class as this object.
It then initializes each of the new object's fields by
assigning it the same value as the corresponding field
in this object. No constructor is called.
- Overrides:
- clone in class Object
createServerSocket
public abstract AdaptorSocket createServerSocket(int port)
- Create a socket to be used on the server side with the given port
createClientSocket
public abstract AdaptorSocket createClientSocket()
- Create a socket to be used on the client side. No port is provided
as the client does not "bind".
getProtocol
public abstract String getProtocol()
- Return the name of the "protocol" used
doBind
public abstract void doBind() throws IOException
- Bind to receive requests (usually used on server side)
- Throws: IOException
- Signals that an I/O exception of some sort has occurred.
doUnbind
public abstract void doUnbind() throws IOException
- Unbind (usually used on server side)
- Throws: IOException
- Signals that an I/O exception of some sort has occurred.
doConnect
public abstract void doConnect(String serverName,
int serverPort) throws UnknownHostException, IOException, CommunicationException
- Connect to send a request (usually used on client side)
- Throws: UnknownHostException
- The IP address of the specified host could not be determined.
- Throws: IOException
- Signals that an I/O exception of some sort has occurred.
- Throws: CommunicationException
- A communications problem occurred.
doDisconnect
public abstract void doDisconnect() throws IOException, CommunicationException
- Can be used on both server and client sides.
On the client side, disconnects the socket used when connecting.
On the server side, disconnects the socket involved in the
communication with the client; it's not usually the socket
used for binding.
- Throws: IOException
- Signals that an I/O exception of some sort has occurred.
- Throws: CommunicationException
- A communications problem occurred.
doSend
public abstract void doSend(String header,
byte content[]) throws IOException
- Send the given header and content to the peer.
On the client side, it's usually the initiated request,
and on the server side, it's the reply to the client's request.
- Throws: IOException
- Signals that an I/O exception of some sort has occurred.
doGetInputStream
public abstract InputStream doGetInputStream() throws IOException
- Return an inputstream for this socket.
- Throws: IOException
- Signals that an I/O exception of some sort has occurred.
doReceive
public abstract InputStream doReceive() throws IOException
- Wait for an incoming message.
On the server side, wait for a request from the client,
and on the client side, wait for the reply to the client's request.
- Throws: IOException
- Signals that an I/O exception of some sort has occurred.
getLocalAddress
public abstract InetAddress getLocalAddress()
- Return the local IP address.
getLocalPort
public abstract int getLocalPort()
- Return the local port number.
getRemoteAddress
public abstract InetAddress getRemoteAddress()
- Return the remote IP address.
getRemotePort
public abstract int getRemotePort()
- Return the remote port number.
getTimeout
public int getTimeout()
- Returns setting for TIMEOUT.
0 returns implies that the option is disabled
(i.e., timeout of infinity).
- Returns:
- the current value of the "Timeout" property.
setTimeout
public void setTimeout(int value)
- Enable/disable TIMEOUT with the specified timeout, in milliseconds.
With this option set to a non-zero timeout, a read() call on the InputStream
associated with this Socket will block for only this amount of time. If the
timeout expires, a java.io.InterruptedIOException is raised, though the Socket
is still valid. The option must be enabled prior to entering the blocking
operation to have effect. The timeout must be > 0. A timeout of zero is
interpreted as an infinite timeout.
- Parameters:
- value - the new value of the property.
All Packages Class Hierarchy This Package Previous Next Index