7074436: (sc) SocketChannel can do short gathering writes when channel configured blocking (win)

Alan Bateman Alan.Bateman at oracle.com
Tue Oct 22 02:06:08 PDT 2013


On Windows then SocketChannel.write has to split large writes into 128k 
chunks in order to support async close when the channel is configured 
blocking. This wasn't implemented completely for gathering writes: if 
the total number of bytes remaining in the buffers exceeds 128k then it 
just writes up to 128k and returns that as the number of bytes written. 
This is problematic for applications that don't expect a short write 
(meaning they don't use the idiom to write until the number of bytes 
remaining is 0 or they don't check the return value).

I'd like to update the gathering write so that it works like the write, 
this means that if the total remaining is >128k then there will be 
multiple calls to WSASend to write the bytes.
   http://cr.openjdk.java.net/~alanb/7074436/webrev/

Thanks,
Alan.


More information about the nio-dev mailing list