-1 and orderly socket shutdown
Leon Finker
leonfin at optonline.net
Wed Apr 22 13:23:10 PDT 2009
Hmm, interesting. Is it ever useful? Maybe it should be treated as error?
-----Original Message-----
From: Alan.Bateman at Sun.COM [mailto:Alan.Bateman at Sun.COM]
Sent: Wednesday, April 22, 2009 4:20 PM
To: Leon Finker
Cc: nio-discuss at openjdk.java.net
Subject: Re: -1 and orderly socket shutdown
Leon Finker wrote:
> I was referring to AsynchronousSocketChannel. But I guess it's to keep it
> the same as SocketChannel. In AsynchronousSocketChannel one would not get
0
> bytes read for tcp, correct? One can get 0 bytes for udp.
>
If you invoke AsynchronousSocketChannel#read with a buffer that has 0
bytes remaining then it completes immediately with a result of 0 (no I/O
operation is initiated).
-Alan.
More information about the nio-discuss
mailing list