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

Alan Bateman Alan.Bateman at oracle.com
Thu Jun 14 09:24:07 PDT 2012


On 14/06/2012 16:08, Zhong Yu wrote:
> :
>
> 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?
>
Normally you won't see short writes in blocking mode. The only "normal" 
case, that I'm aware of anyway, is on Windows where you you attempt to 
write with >= 128k bytes remaining in the buffer and that is the case 
that this patch attempts to smooth over. There are one or two cases odd 
cases, say where someone does write(ByteBuffer[]) with an array of 
hundreds of buffers, more than IOV_MAX. I think the only thing we can do 
is set expectations in the javadoc and that is something I plan to do.

-Alan


More information about the nio-dev mailing list