|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jarol.messages.Link jarol.messages.TCPServerLink
public class TCPServerLink
TCP server socket message link.
This message link allows simple bi-directional communication using a server TCP socket.
Note that the TCP server link may have multiple peers. Messages from all peers will be placed on the link's receive port and any messages in the link's send port will be sent to all connected peers at any time.
Field Summary |
---|
Fields inherited from class jarol.messages.Link |
---|
DEFAULT_PORT_BUFSZ, MAX_MESSAGE_PAYLOAD |
Constructor Summary | |
---|---|
TCPServerLink(MessageFactory factory,
int port)
Constructor. |
Method Summary | |
---|---|
protected int |
recv(byte[] buf,
int off,
int len,
int timeout)
Receive data over the TCP server link. |
protected void |
send(byte[] data,
int off,
int len)
Send data over the TCP server link. |
protected void |
start()
Start the TCP server link. |
protected void |
stop()
Stop the TCP server link. |
Methods inherited from class jarol.messages.Link |
---|
connect, connected, disconnect, getRecvPort, getSendPort, getSendSignal |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TCPServerLink(MessageFactory factory, int port)
factory
- the message factory to useport
- server port to useMethod Detail |
---|
protected void start() throws java.io.IOException
start
in class Link
java.io.IOException
- if a network error occursprotected void stop() throws java.io.IOException
stop
in class Link
java.io.IOException
- if a network error occursprotected int recv(byte[] buf, int off, int len, int timeout) throws java.io.IOException
recv
in class Link
buf
- read bufferoff
- read buffer offsetlen
- read buffer usable lengthtimeout
- timeout for receive
java.io.IOException
- if a network error occursprotected void send(byte[] data, int off, int len) throws java.io.IOException
send
in class Link
data
- the message payloadoff
- payload offsetlen
- payload length
java.io.IOException
- if a network error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |