7176630: (sc) SocketChannel.write does not write more than 128k when channel configured blocking [win]

Zhong Yu zhong.j.yu at gmail.com
Thu Jun 14 08:08:41 PDT 2012


On Wed, Jun 13, 2012 at 6:28 PM, Esmond Pitt <esmond.pitt at bigpond.com> wrote:
> Alan
>
> I suggest the loop should only happen in blocking mode, if at all.
> Non-blocking mode programs must already cope with short writes, and
> shouldn't be held up dispatching writes, on fairness grounds. I'm not
> convinced about the need for the loop in blocking mode either, as
> applications must be written correctly, and forums are already full of war
> stories about checking write (and read) return values in java.nio and indeed
> java.net and java.io.

Esmond, can you send some links to these discussions?

Alan, if a short write occurs in blocking mode, what is the caller
supposed to do? Apparently it's not an error condition, so the caller
can immediately try write() again on the remaining bytes?

Thanks,
Zhong Yu


More information about the nio-dev mailing list