Shouldn't you use out.println(" Hello World ");

John

On 7/22/06, hpq852 <[EMAIL PROTECTED]> wrote:
Hello Everyone, I'm using Mina for a TCP Server, but I  suffer from a question 
which I can't resolve it and I beg your help. Thank you very much and the 
question is as following :

  Client side :  I have 10 threads  and the run method is :

    public void run()
    {
          for(int i=0; i<1; i++)
          {
              out.print(" Hello World ");
              out.flush();
          }
    }

  I have flushed after every 'print' operation. In server side  I want to get 
the result as :

      Hello World
  ----------------
      Hello World
  ----------------
      Hello World
  ----------------
      Hello World
  ----------------
      Hello World
  ----------------
      Hello World
  ----------------
   ......

 but the result which I get is :

 Hello  World Hello World Hello World Hello World Hello World Hello World Hello 
World Hello World Hello World Hello World
-----------------------

The code in server side is :

 public synchronized void dataRead(IoSession session, ByteBuffer rb) throws 
Exception
 {
        byte[] datas = new byte[rb.remaining()];
        rb.get(datas);

        String commandStr = new String(datas);
        logger.info(commandStr);
        logger.info("----------------------------------");
 }

what's the reason ?  By the way the mina I'm using is verson 0.8.  Thanks a lot 
. Best wishes!


Reply via email to