AsynchronousByteCharChannel and Timeouts
Alan Bateman
Alan.Bateman at oracle.com
Thu Jul 15 08:13:49 PDT 2010
cowwoc wrote:
> :
> Please make sure that this is spelled out explicitly in the
> specification. I did not think of this and I suspect that others might
> not as well. Either way, I prefer that the specification spell this
> out explicitly so users don't have to make assumptions.
Sure, but just to say that the read semantics aren't any different to
what developers are used to elsewhere. Even a blocking read will return
once it has read something. It doesn't block until it has filled the
entire buffer or EOF is encountered.
>
> :
> How can users develop robust software on top of sockets, serial
> ports, and other potentially-blocking streams without timeout support?
> Don't all operating systems provide timeout support for them anyway?
I can't speak for all operating system but typically you have to work to
add timeouts. With blocking and non-blocking I/O then you usually have
to poll with a timeout before you read. Windows does have some support
for timeouts in blocking reads (it's Microsoft specific and not part of
the winsock spec AFAIK). Like us, they warn that the socket is is in
indeterminate state and may lead to data loss when a timeout occurs.
Serial communication is at a lower level and involves several timeouts
so I would expect some operating system support.
-Alan.
More information about the nio-discuss
mailing list