AsynchronousSocketChannel write()

Alan Bateman Alan.Bateman at oracle.com
Thu Sep 2 13:38:32 PDT 2010


Avinash Lakshman wrote:
> Should I assume similar semantics with the UDP too? I/O is not 
> completed in a single operation even in UDP.
UDP/datagrams are different as each send/write will send a datagram; 
each receive/read will read a datagram. Your MTU size will limit the 
size of the datagram that you can use. The send/receive buffer sizes 
also come into play as datagrams may be discarded (on some platforms) if 
you attempt to send/write a datagram that is larger than the buffer 
size. Same thing the receive side. So the semantics are different and 
you probably won't want to do another send/write if there bytes 
remaining from the first send/write.

-Alan.


More information about the nio-discuss mailing list