|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.jaw.impl.adaptor.comm.AdaptorSocket
The AdaptorSocket
class provides a wrap-up of the
socket to be used for HTTP-based adaptors.
Field Summary | |
protected int |
port
The local port number. |
Constructor Summary | |
AdaptorSocket()
|
Method Summary | |
java.lang.Object |
clone()
Creates a new object of the same class as this object. |
abstract AdaptorSocket |
createClientSocket()
Creates a socket to be used on the client side. |
abstract AdaptorSocket |
createServerSocket(int port)
Creates a socket to be used on the server side with the given port. |
abstract void |
doBind()
Binds to receive requests (usually used on server side). |
abstract void |
doConnect(java.lang.String serverName,
int serverPort)
Connects to send a request (usually used on client side). |
abstract void |
doDisconnect()
Can be used on both server and client sides. |
abstract java.io.InputStream |
doGetInputStream()
Returns an input stream for this socket. |
abstract java.io.InputStream |
doReceive()
Waits for an incoming message. |
abstract void |
doSend(java.lang.String header,
byte[] content)
Sends the given header and content to the peer. |
abstract void |
doUnbind()
Unbinds (usually used on server side). |
abstract java.net.InetAddress |
getLocalAddress()
Gets the local IP address. |
abstract int |
getLocalPort()
Gets the local port number. |
abstract java.lang.String |
getProtocol()
Gets the name of the protocol used. |
abstract java.net.InetAddress |
getRemoteAddress()
Gets the remote IP address. |
abstract int |
getRemotePort()
Gets the remote port number. |
int |
getTimeout()
Gets setting for Timeout . |
void |
setTimeout(int value)
Enables/disables Timeout with the specified timeout, in milliseconds. |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected int port
Constructor Detail |
public AdaptorSocket()
Method Detail |
public java.lang.Object clone()
public abstract AdaptorSocket createServerSocket(int port)
port
- The port number.public abstract AdaptorSocket createClientSocket()
public abstract java.lang.String getProtocol()
public abstract void doBind() throws java.io.IOException
public abstract void doUnbind() throws java.io.IOException
public abstract void doConnect(java.lang.String serverName, int serverPort) throws java.net.UnknownHostException, java.io.IOException, CommunicationException
serverName
- The name of the server to connect the socket to.serverPort
- The port number of the specified server.public abstract void doDisconnect() throws java.io.IOException, CommunicationException
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.
public abstract void doSend(java.lang.String header, byte[] content) throws java.io.IOException
header
- The header to be sent.content
- The content to be sent.public abstract java.io.InputStream doGetInputStream() throws java.io.IOException
public abstract java.io.InputStream doReceive() throws java.io.IOException
On the server side, waits for a request from the client, and on the client side, waits for the reply to the client's request.
public abstract java.net.InetAddress getLocalAddress()
public abstract int getLocalPort()
public abstract java.net.InetAddress getRemoteAddress()
public abstract int getRemotePort()
public int getTimeout()
Timeout
.
0 returns implies that the option is disabled
(i.e. timeout of infinity).Timeout
property.public void setTimeout(int value)
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.value
- The new value of the property.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |