Using the Sun Java VM 1.5 or 1.6 on Windows, I connect a non-blocking socket. I then fill a ByteBuffer
with a message to output, and attempt to write()
to the SocketChannel.
I expect the write to complete only partially if the amount to be written is greater than the amount of space in the socket's TCP output buffer (this is what I expect intuitively, it's also pretty much my understanding of the docs), but that's not what happens. The write()
always seems to return reporting the full amount written, even if it's several megabytes (the socket's SO_SNDBUF is 8KB, much, much less than my multi-megabyte output message).
A problem here is that I can't test the code that handles the case where the output is partially written (registering an interest set of WRITE
to a selector and doing a select()
to wait until the remainder can be written), as that case never seems to happen. What am I not understanding?