AmalRaj P wrote:
Client:
Will just receive the message and print it
public void messageReceived(IoSession session, Object message)
{
ByteBuffer buffer = (ByteBuffer) message;
byte[] data = new byte[buffer.remaining()];
buffer.get(data);
Object obj = NotificationObject.getObject(data);
System.out.println("ClientHandler : data received is : " + obj);
}
Results:
Client1 Missed: 203, 253, 293
Client2 Missed: 204, 252
Client3 Missed: 247, 252
I don’t know why I am getting packet loss in the Client side. Need some help
as every single notification in our process cannot be missed.
You cannot expect one write() on the server side to correspond to one
messageReceived() call on the client side. The network layer may decide
to split/combine bytes in order to optimize transport as it sees fit.
Please have a look at the ProtocolCodecFilter. There's a nice tutorial
which explains how to use it on the MINA web site. If you are using the
latest trunk version of MINA I think there is a new codec implmentation
in there which sends length prefixed string. It seems like you could use
that out of the box.
HTH
/Niklas