It's unlikely that MINA misses any data unless there's disconnection.

It might be because you are releasing the buffer unnecessarily.
Please remove the two lines (buffer.release() and buffer = null).
Also, make sure no exception is caught in your IoHandler
implementation.

There's also possibility you are not taking care of TCP/IP packet
fragmentation in NotificationObject.getObject(...) (i.e. two messages
are received in one ByteBuffer.)

Trustin

On Dec 11, 2007 11:11 PM, AmalRaj P <[EMAIL PROTECTED]> wrote:
>
> 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.
>
>



-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to