Modifier and Type | Class and Description |
---|---|
(package private) class |
NGNetwork.CnxHandler.MessageInputStream
Class used to read messages through a stream.
|
(package private) class |
NGNetwork.CnxHandler.MessageOutputStream
Class used to send messages through a stream.
|
Modifier and Type | Field and Description |
---|---|
(package private) ByteBuffer |
bufin
Informations for input
|
(package private) ByteBuffer |
bufout |
(package private) SocketChannel |
channel
The communication socket channel
|
(package private) long |
lasttry
Date of last connection attempt
|
private boolean |
local
True if a "local" connection is in progress, a local connection
is initiated from this server to the remote one (defined by the
server descriptor. |
(package private) NGNetwork.CnxHandler.MessageInputStream |
mis |
(package private) NGNetwork.CnxHandler.MessageOutputStream |
mos |
private String |
name
The handler's name.
|
(package private) int |
nbwrite
Informations for output
|
(package private) NGNetwork.MessageVector |
sendlist
FIFO list of all messages to be sent
|
private ServerDesc |
server
The description of the remote server handled by this network session
|
private short |
sid
Destination server id
|
Constructor and Description |
---|
NGNetwork.CnxHandler(String name,
short sid) |
Modifier and Type | Method and Description |
---|---|
private void |
ack(int stamp) |
(package private) void |
close() |
private void |
doAck(int ack)
Removes all messages in sendList previous to the ack'ed one.
|
String |
getName()
Returns this session's name.
|
(package private) void |
init() |
(package private) boolean |
localStart()
Its method is called by start in order to
initiate a connection from the local server.
|
private void |
read()
Method called each time the channel is Readable
|
(package private) boolean |
remoteStart(SocketChannel channel,
int boot)
Its method is called by start
in order to reply to a connection request from a remote server.
|
(package private) void |
send(Message msg) |
(package private) void |
start() |
private void |
startEnd()
The session is well initialized, we can start the server thread that
"listen" the connected socket.
|
String |
toString() |
private void |
write()
Method called each time the channel is Writable
|
private short sid
private String name
private boolean local
server
descriptor.
This attribute is used to synchronize local and remote attempts to
make connections.private ServerDesc server
SocketChannel channel
long lasttry
int nbwrite
ByteBuffer bufout
NGNetwork.MessageVector sendlist
ByteBuffer bufin
NGNetwork.CnxHandler(String name, short sid) throws IOException
IOException
void init() throws IOException, UnknownServerException
IOException
UnknownServerException
public final String getName()
void start() throws IOException
IOException
boolean localStart()
In order to overide the protocol, we have to implements its method, with the remoteStart and the transmit methods.
boolean remoteStart(SocketChannel channel, int boot)
sock
- the connected socketois
- the input streamoos
- the output streamprivate void startEnd() throws IOException
IOException
void send(Message msg) throws IOException
IOException
private void write() throws IOException
IOException
private void read() throws Exception
Exception
private final void doAck(int ack) throws IOException
IOException
void close() throws IOException
IOException
Copyright © 2018 ScalAgent D.T.. All Rights Reserved.