
21 Aug
2010
21 Aug
'10
3:18 p.m.
On Sat, Aug 21, 2010 at 11:35, Gregory Collins
John Millikin
writes: I think the docs are wrong, or perhaps we're misunderstanding them. Magnus is correct.
Attached is a test program which listens on two ports, 42000 (blocking IO) and 42001 (non-blocking). You can use netcat, telnet, etc, to send it data. The behavior is as Magnus describes: bytes from hGetNonBlocking are available immediately, while hGet waits for a full buffer (or EOF) before returning.
"hSetBuffering handle NoBuffering"?
The implementation as it is is fine IMO.
Disabling buffering doesn't change the behavior -- hGet h 20 still doesn't return until the handle has at least 20 bytes of input available.