|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectp2ps.imp.endpoint.TCP.TCPEndpoint
A generic TCP socket class
| Field Summary | |
static int |
READ_BUFFER_SIZE
|
static int |
RECEIVE_BUFFER_SIZE
|
static int |
SEND_BUFFER_SIZE
|
| Constructor Summary | |
TCPEndpoint(java.lang.String scheme,
MessageProtocolHandler messhandler)
Creates a TCP endpoint |
|
TCPEndpoint(java.lang.String scheme,
MessageProtocolHandler messhandler,
java.util.Map properties)
Creates a TCP endpoint |
|
TCPEndpoint(java.lang.String scheme,
Socket socket,
MessageProtocolHandler messhandler)
Creates a TCP endpoint with the specified socket handler. |
|
| Method Summary | |
void |
addEndpointMessageListener(EndpointMessageListener listener)
Adds a listener to receive data from this socket |
void |
close()
Closes the endpoint. |
void |
connect(java.lang.String address,
int port)
Connects the socket to a specified address and port |
protected Socket |
createSocket(java.net.SocketAddress address,
java.util.Map properties)
Creates the socket |
java.net.URI |
getEndpointURI()
|
protected java.io.InputStream |
getInputStream()
|
protected MessageProtocolHandler |
getMessageProtocolHandler()
|
protected java.io.OutputStream |
getOutputStream()
|
java.net.URI |
getSendURI()
|
protected Socket |
getSocket()
|
void |
init()
initializes the endpoint |
void |
initConnection()
Connects the endpoint |
protected void |
initMessageHandling()
Initializes the message handler utilities |
boolean |
isBlock()
|
boolean |
isClose()
|
boolean |
isClosed()
|
boolean |
isInputEndpoint()
|
protected boolean |
isMessageHandlingEnabled()
|
boolean |
isOutputEndpoint()
|
void |
receiveMessage(DataMessage mess)
handle the specified Data Message received on the specified endpoint |
void |
removeEndpointMessageListener(EndpointMessageListener listener)
Removes a listener from this socket |
java.io.InputStream |
retrieveInputStream()
An InputStream for the endpoint. |
java.io.OutputStream |
retrieveOutputStream()
An OutputStream for the endpoint. |
void |
send(byte[] message)
Sends a message from the endpoint to the address the endpoint is bound to, with no sendid. |
void |
send(java.lang.String sendid,
byte[] message)
Send a message from the socket |
void |
setBlock(boolean block)
Sets whether blocking sends are used |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static int RECEIVE_BUFFER_SIZE
public static int SEND_BUFFER_SIZE
public static int READ_BUFFER_SIZE
| Constructor Detail |
public TCPEndpoint(java.lang.String scheme,
Socket socket,
MessageProtocolHandler messhandler)
throws java.io.IOException
public TCPEndpoint(java.lang.String scheme,
MessageProtocolHandler messhandler)
throws java.io.IOException
public TCPEndpoint(java.lang.String scheme,
MessageProtocolHandler messhandler,
java.util.Map properties)
throws java.io.IOException
| Method Detail |
protected Socket createSocket(java.net.SocketAddress address,
java.util.Map properties)
throws java.io.IOException
java.io.IOExceptionpublic void addEndpointMessageListener(EndpointMessageListener listener)
addEndpointMessageListener in interface Endpointpublic void removeEndpointMessageListener(EndpointMessageListener listener)
removeEndpointMessageListener in interface Endpoint
public void init()
throws java.io.IOException
Endpoint
init in interface Endpointjava.io.IOException
public void initConnection()
throws java.io.IOException
java.io.IOException
protected void initMessageHandling()
throws java.io.IOException
java.io.IOExceptionpublic java.net.URI getEndpointURI()
getEndpointURI in interface Endpointpublic java.net.URI getSendURI()
getSendURI in interface Endpointpublic boolean isInputEndpoint()
isInputEndpoint in interface Endpointpublic boolean isOutputEndpoint()
isOutputEndpoint in interface Endpointpublic boolean isBlock()
public void setBlock(boolean block)
public void connect(java.lang.String address,
int port)
throws java.io.IOException
java.io.IOExceptionprotected Socket getSocket()
public java.io.InputStream retrieveInputStream()
throws java.io.IOException
retrieveInputStream in interface StreamEndpointjava.io.IOException
public java.io.OutputStream retrieveOutputStream()
throws java.io.IOException
retrieveOutputStream in interface StreamEndpointjava.io.IOExceptionprotected java.io.InputStream getInputStream()
protected java.io.OutputStream getOutputStream()
protected boolean isMessageHandlingEnabled()
protected MessageProtocolHandler getMessageProtocolHandler()
public void receiveMessage(DataMessage mess)
public void send(byte[] message)
throws java.io.IOException
send in interface Endpointjava.io.IOException
public void send(java.lang.String sendid,
byte[] message)
throws java.io.IOException
send in interface Endpointjava.io.IOException
public void close()
throws java.io.IOException
close in interface Endpointjava.io.IOExceptionpublic boolean isClose()
public boolean isClosed()
isClosed in interface Endpointpublic java.lang.String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||