Babak Farhang wrote:
for ( int i = 0; i < yourData.lengh; i+=10000 ) {
  byte[] temp = new byte[100000];
  System.arrayCopy( yourData, i, temp, 0, 10000);
  session.write( temp );
}

If session.write(temp) doesn't block, then we might end up having
written all 100K into memory before anything was written to the
socket. No?

I was thinking maybe there's a way to write a 10K chunk, and have MINA
callback me back when it's finished writing it, so that I can write
the next 10K chunk, and so on, until the whole message is written.
So just send the first chunk in the messageReceived() method, and in the messageSent() method, send the following chunks as you receive the 'SENT' event.

--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to