All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.jaw.impl.adaptor.udp.AdaptorSocket

java.lang.Object
   |
   +----com.sun.jaw.impl.adaptor.comm.AdaptorSocket
           |
           +----com.sun.jaw.impl.adaptor.udp.AdaptorSocket

public class AdaptorSocket
extends AdaptorSocket
/** The AdaptorSocket class provides a wrap-up of the socket to be used for an HTTP-based adaptor using UDP.


Constructor Index

 o AdaptorSocket()
Constructs an HTTP/UDP adaptor socket.
 o AdaptorSocket(int)

Method Index

 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 On the client side, it's usually the initiated request, and on the server side, it's the reply to the client's request.
 o doUnbind()
Unbind (usually used on server side)
 o getLocalAddress()
Return the local IP address.
 o getLocalPort()
Return the local port number.
 o getMsgSize()
 o getProtocol()
Return the name of the "protocol" used
 o getRemoteAddress()
Return the remote IP address.
 o getRemotePort()
Return the remote port number.
 o setMsgSize(int)
 o toString()
Returns a string representation of the object.

Constructors

 o AdaptorSocket
 public AdaptorSocket()
Constructs an HTTP/UDP adaptor socket.

 o AdaptorSocket
 public AdaptorSocket(int port)

Methods

 o createServerSocket
 public AdaptorSocket createServerSocket(int port)
Create a socket to be used on the server side with the given port

Overrides:
createServerSocket in class AdaptorSocket
 o createClientSocket
 public AdaptorSocket createClientSocket()
Create a socket to be used on the client side. No port is provided as the client does not "bind".

Overrides:
createClientSocket in class AdaptorSocket
 o getProtocol
 public String getProtocol()
Return the name of the "protocol" used

Overrides:
getProtocol in class AdaptorSocket
 o doBind
 public 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.
Overrides:
doBind in class AdaptorSocket
 o doUnbind
 public void doUnbind() throws IOException
Unbind (usually used on server side)

Throws: IOException
Signals that an I/O exception of some sort has occurred.
Overrides:
doUnbind in class AdaptorSocket
 o doConnect
 public void doConnect(String serverName,
                       int serverPort) throws UnknownHostException, IOException
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.
Overrides:
doConnect in class AdaptorSocket
 o doDisconnect
 public 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.
Overrides:
doDisconnect in class AdaptorSocket
 o doSend
 public 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.
Overrides:
doSend in class AdaptorSocket
 o doReceive
 public 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.
Overrides:
doReceive in class AdaptorSocket
 o doGetInputStream
 public InputStream doGetInputStream() throws IOException
Return an inputstream for this socket.

Throws: IOException
Signals that an I/O exception of some sort has occurred.
Overrides:
doGetInputStream in class AdaptorSocket
 o getLocalAddress
 public InetAddress getLocalAddress()
Return the local IP address.

Overrides:
getLocalAddress in class AdaptorSocket
 o getLocalPort
 public int getLocalPort()
Return the local port number.

Overrides:
getLocalPort in class AdaptorSocket
 o getRemoteAddress
 public InetAddress getRemoteAddress()
Return the remote IP address.

Overrides:
getRemoteAddress in class AdaptorSocket
 o getRemotePort
 public int getRemotePort()
Return the remote port number.

Overrides:
getRemotePort in class AdaptorSocket
 o toString
 public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
 o getMsgSize
 public int getMsgSize()
 o setMsgSize
 public void setMsgSize(int s)

All Packages  Class Hierarchy  This Package  Previous  Next  Index