|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--solar.service.transport.TcpConnection
The connection between two TCP peers.
Field Summary | |
private AduFactory |
_aduFactory
|
private java.io.DataInputStream |
_datain
|
private java.io.DataOutputStream |
_dataout
|
private java.io.DataInput |
_in
|
private java.io.ObjectInputStream |
_objin
|
private java.io.ObjectOutputStream |
_objout
|
private java.io.DataOutput |
_out
|
private SocketAddress |
_peer
The peer address. |
private java.lang.Thread |
_receiver
The thread receiving messages from this connection. |
private boolean |
_serialize
|
private java.net.Socket |
_sock
The local socket for the connection. |
private TcpTransport |
_transport
|
private byte[] |
COOKIE
The cookie identifying our protocol handshake. |
Constructor Summary | |
TcpConnection(boolean serialize,
java.net.Socket sock,
SocketAddress peer)
Constructs a new connection from a local connected socket. |
Method Summary | |
void |
destroy()
Destory this connection. |
private void |
doSend(Adu adu,
Header header)
|
void |
init(TcpTransport transport)
Initialize this connection. |
private void |
initCookie(byte[] c)
|
private boolean |
matchCookie(byte[] cookie)
|
SocketAddress |
receivePeerAddress()
Receive peer address from this connection. |
void |
run()
|
void |
send(Adu adu,
Header header)
Send a message through this connection. |
void |
send(byte[] data,
Header header)
Send a message through this connection. |
void |
sendLocalAddress(SocketAddress addr)
Send local address to peer through this connection. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private final byte[] COOKIE
private java.net.Socket _sock
private SocketAddress _peer
private java.lang.Thread _receiver
private java.io.DataInputStream _datain
private java.io.DataOutputStream _dataout
private java.io.ObjectInputStream _objin
private java.io.ObjectOutputStream _objout
private java.io.DataInput _in
private java.io.DataOutput _out
private boolean _serialize
private AduFactory _aduFactory
private TcpTransport _transport
Constructor Detail |
public TcpConnection(boolean serialize, java.net.Socket sock, SocketAddress peer) throws java.lang.Exception
Method Detail |
public void init(TcpTransport transport)
public void destroy()
public SocketAddress receivePeerAddress() throws java.lang.Exception
java.lang.Exception
public void sendLocalAddress(SocketAddress addr) throws java.lang.Exception
java.lang.Exception
public void send(byte[] data, Header header) throws java.lang.Exception
java.lang.Exception
public void send(Adu adu, Header header) throws java.lang.Exception
java.lang.Exception
private void doSend(Adu adu, Header header) throws java.lang.Exception
java.lang.Exception
private void initCookie(byte[] c)
private boolean matchCookie(byte[] cookie)
public void run()
run
in interface java.lang.Runnable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |