
Signature
And loving it,
-Q
_________________________________________________
Qu0llSixFour@gmail.com
(Replace the "SixFour" with numbers to email me)
> I have a ByteBuffer named "buf" which is created by the
> ByteBuffer.allocate() method and is set to size 1024 bytes for each
[quoted text clipped - 16 lines]
> the flush() method to flush the buffer but I can't see how to do
> something similar here given that I am writing directly to the channel.
It's not the channel, or anything else you can control from Java. It's
the TCP send buffer filling up, which means that the receiver's receive
buffer has filled up, which means that he is reading slower than you are
writing.
This is what OP_WRITE is for if you're using non-blocking I/O: register
on it and select(), and when it fires write again: if that succeeds
completely, deregister OP_WRITE. If you're using blocking I/O, just
write in a loop while buf.remaining() > 0.
Qu0ll - 12 Nov 2007 02:04 GMT
> It's not the channel, or anything else you can control from Java. It's the
> TCP send buffer filling up, which means that the receiver's receive buffer
[quoted text clipped - 4 lines]
> completely, deregister OP_WRITE. If you're using blocking I/O, just write
> in a loop while buf.remaining() > 0.
Thank you Esmond. The problem does appear to have been that the client was
not processing the data quickly enough. I have corrected that and all
writes are now going through fully.

Signature
And loving it,
-Q
_________________________________________________
Qu0llSixFour@gmail.com
(Replace the "SixFour" with numbers to email me)