|
|||||||||
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 | +--com.sun.jaw.impl.adaptor.http.AdaptorSocket
The AdaptorSocket
class provides a wrap-up of the
socket to be used for a HTTP-based adaptor using TCP.
Fields inherited from class com.sun.jaw.impl.adaptor.comm.AdaptorSocket |
port |
Constructor Summary | |
AdaptorSocket()
Constructs a HTTP/TCP adaptor socket. |
|
AdaptorSocket(int port)
Constructs a HTTP/TCP adaptor socket. |
Method Summary | |
AdaptorSocket |
createClientSocket()
Creates a socket to be used on the client side. |
AdaptorSocket |
createServerSocket(int port)
Creates a socket to be used on the server side with the given port. |
void |
doBind()
Binds to receive requests (usually used on server side). |
void |
doConnect(java.lang.String serverName,
int serverPort)
Connects to send a request (usually used on client side). |
void |
doDisconnect()
Disconnects the adaptor socket. |
java.io.InputStream |
doGetInputStream()
Returns an input stream for this adaptor socket. |
java.io.InputStream |
doReceive()
Waits for an incoming message. |
void |
doSend(java.lang.String header,
byte[] content)
Sends the given header and content to the peer. |
void |
doUnbind()
Unbinds (usually used on server side). |
java.net.InetAddress |
getLocalAddress()
Returns the local IP address. |
int |
getLocalPort()
Returns the local port number. |
java.lang.String |
getProtocol()
Returns the name of the "protocol" used ("http"). |
java.net.InetAddress |
getRemoteAddress()
Returns the remote IP address. |
int |
getRemotePort()
Returns the remote port number. |
java.lang.String |
toString()
Returns the implementation address and implementation port of this socket as a string. |
Methods inherited from class com.sun.jaw.impl.adaptor.comm.AdaptorSocket |
clone,
getTimeout,
setTimeout |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public AdaptorSocket()
public AdaptorSocket(int port)
port
- The port number.Method Detail |
public AdaptorSocket createServerSocket(int port)
port
- The port number.public AdaptorSocket createClientSocket()
No port is provided as the client does not "bind".
public java.lang.String getProtocol()
public void doBind() throws java.io.IOException
public void doUnbind() throws java.io.IOException
public 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 void doDisconnect() throws java.io.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.
public void doSend(java.lang.String header, byte[] content) throws java.io.IOException
On the client side, it's usually the initiated request, and on the server side, it's the reply to the client's request.
header
- The header to be sent.content
- The content to be sent.public java.io.InputStream doReceive() throws java.io.IOException
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.
public java.io.InputStream doGetInputStream() throws java.io.IOException
public java.net.InetAddress getLocalAddress()
public int getLocalPort()
public java.net.InetAddress getRemoteAddress()
public int getRemotePort()
public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |