On Dec 15, 2007 5:52 AM, Mike Heath <[EMAIL PROTECTED]> wrote:
> Steve Johns wrote:
> > Thanks for Mina. It is a great project.
> > After I am trying out the Mina, I had some questions.
> > 1) If the server session.write() a message, however client network is
> really
> > SLOW. Will mina keep trying to send
> > out the message until timeout?(I guess session.settimeout() is applied
> > here). If so, how IoHandler get notified from this
> > event message? (Through exceptionCaught, close session?). Why NOT
> > accumulated writeQueue size > user defined size and exception?
>
> MINA only passes the message on to the OS once. It is the OS'
> responsibility to manage TCP timeouts and resend dropped packets. If
> the TCP connection timesout, an exception will be thrown and it can be
> handled in IoHandler.exceptionCaught.
I may not make myself clear. If I send 100 bytes length of packets, however,
only 50 bytes are sent. (int sentBytes = socket.write(bytes[])). I meant if
Mina will put the left 50 bytes back to the queue and send them again?
>
>
> > 2) If the server wants to send the same message to all 1000 sessions,
> should
> > I encode the same message 1000 times
> > in the encoder extend the messageEncoder? If so, that kinda affects the
> > performance.
>
> If you send the message as a Java Object, it will have to be encoded
> 1,000 times. If you're going to be broadcasting a message to lots of
> clients, I would recommend encoding it once, and then doing something
> like:
>
> for (IoSession session : allRecipients) {
> session.write(myEncodedBuffer.duplicate());
> }
Which means I have to do the Encode part in the IoHandlerAdapter but NOT in
my encoder, right? That really mixes up the communication and business
logic.
>
>
> or if you're using MINA TRUNK, you could just use IoUtil.broadcast.
Sounded great.
>
>
> > 3) In Mina web document, source code 1.1.x->main
> > the "WORK" class link under org.apache.mina.transport.socket.nio is
> wrong.
>
> I'm sorry. I don't understand where this link problem is. Please
> clarify on this.
>
> > Finally, thanks Trustin.
>
> Yes, Trustin is my hero.
You are my hero, too. :)
>
>
> -Mike
>