In my project I am using MINA framework for notification, with multiple
clients in place I faced packet loss issues.
Then I planned to setup a sample environment with a server and three clients
connected to it.
Server:
Will publish numbers generated in loop to all clients connected/registered
public void run()
{
IoSession session = null;
int j = 0;
while (j < 500)
{
for (int i = 0; i < sessions.size(); i++)
{
String msg = "For client " + i + " value sent is:" + j;
System.out.println(msg);
byte data[] = NotificationObject.getBytes(new String(msg));
ByteBuffer buffer = ByteBuffer.wrap(data);
session = (IoSession) sessions.get(i);
session.write(buffer);
buffer.release();
buffer = null;
}
j++;
}
}
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.
I have attached the test setup. Just use the batch files inside bin. Sample
logs where you can see the issues are also available.
http://www.nabble.com/file/p14274506/MinaTestSetup.zip MinaTestSetup.zip
--
View this message in context:
http://www.nabble.com/Packet-loss-Issue-tp14274506s16868p14274506.html
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.