You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Hooman Valibeigi <ho...@gmail.com> on 2006/09/13 14:24:39 UTC

Help

Hi everyone
I know this mailing list is not a place to ask beginner questions
please forgive me
I would be glad if someone help me resolve my problem with MINA
I've implemented a very simple chat server to test the MINA's facilities
however it has problems that I cant understand why
the source code is attached please download it

to run server type
> java Server
to run client type as many as you want.
> java Client
all clients will be connected to server and they can send and receive
messages
however sometimes the the messages will not reach the clients although the
server have sent them
server writes to all registered clients and I can see they messages have
been sent out from the server side
but no client will be notified thru the IoHandler.dataRead() method
this problems only happens sometimes. would you please check my source code
and correct my problem ?

another question/problem I have is about partially read messages. after I
learned the MINA I have migrate to my real project and I decided to
implement it using MINA. in my application, a client's request starts with a
REQUEST id of type int and then a sequence of primitive data and objects
(consisting of int,string,byte,serialized objects,etc) could be written and
sent to the server. so my Q is how should I handle partially read messages
from clients ? I mean when IoHandler notifies me that an IoSession is ready
to read data (thru IoHandler.dataRead method) how should I handle the
ByteBuffer in order to get the entire Request's data (from the REQUEST id to
the last data that has been written into the stream). if there were more
than one Requests inside the ByteBuffer, how should I handle it to not lose
anything ?

I would be glad if someone refer me to some examples that fits my need as
described above. I did not see any similar sample code in MINA's examples.

Thank you in advance.