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.
> 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());
}
or if you're using MINA TRUNK, you could just use IoUtil.broadcast.
> 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.
-Mike