I do not quite understand the problem. Do you want every "Hello World" to be
in a separate TCP packet ?
I don't think it is a good idea to try to accomplish that behavior.
Your code should not depend on the number of packets used to transfer the
data.

Why don't you use delimiter to tell the messages apart ?
Our use TextLineDecoder:

http://directory.apache.org/subprojects/mina/apidocs/org/apache/mina/filter/codec/textline/TextLineDecoder.html

btw, any particular reason you are still using MINA 0.8 ?

Maarten

On 7/24/06, peter royal <[EMAIL PROTECTED]> wrote:

On Jul 23, 2006, at 11:14 AM, hpq852 wrote:
> It alse can't work well, Now the client is :
>
>     public void run()
>     {
>      for(int i=0; i<10; i++)
>      {
>       out.print(" Hello World \n");
>       out.flush();
>      }
>     }
>
> if I invode the flush method for 10 times, I also want to get the
> dataRead(IoSession session, ByteBuffer rb) mothed invoked

Try toggling TCP_NODELAY. By default, your TCP stack will try to
combine data into a single packet, which would result in fewer
invocations of dataRead.

-epte


--
[EMAIL PROTECTED] - http://fotap.org/~osi






Reply via email to