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.


Constructor Index

 o AdaptorSocket()

Method Index

 o clone()
Creates a new object of the same class as this object.
 o createClientSocket()
Create a socket to be used on the client side.
 o createServerSocket(int)
Create a socket to be used on the server side with the given port
 o doBind()
Bind to receive requests (usually used on server side)
 o doConnect(String, int)
Connect to send a request (usually used on client side)
 o doDisconnect()
Can be used on both server and client sides.
 o doGetInputStream()
Return an inputstream for this socket.
 o doReceive()
Wait for an incoming message.
 o doSend(String, byte[])
Send the given header and content to the peer.
 o doUnbind()
Unbind (usually used on server side)
 o getLocalAddress()
Return the local IP address.
 o getLocalPort()
Return the local port number.
 o getProtocol()
Return the name of the "protocol" used
 o getRemoteAddress()
Return the remote IP address.
 o getRemotePort()
Return the remote port number.
 o getTimeout()
Returns setting for TIMEOUT.
 o setTimeout(int)
Enable/disable TIMEOUT with the specified timeout, in milliseconds.

Constructors

 o AdaptorSocket
 public AdaptorSocket()

Methods

 o 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
 o createServerSocket
 public abstract AdaptorSocket createServerSocket(int port)
Create a socket to be used on the server side with the given port

 o 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".

 o getProtocol
 public abstract String getProtocol()
Return the name of the "protocol" used

 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o 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.
 o getLocalAddress
 public abstract InetAddress getLocalAddress()
Return the local IP address.

 o getLocalPort
 public abstract int getLocalPort()
Return the local port number.

 o getRemoteAddress
 public abstract InetAddress getRemoteAddress()
Return the remote IP address.

 o getRemotePort
 public abstract int getRemotePort()
Return the remote port number.

 o 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.
 o 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