Eric wrote:
I tried to turn off buffering with the command hSetBuffering (from
System.IO) but my app still blocks on hGetContents (from
Data.ByteString). Does anyone know what's happening?
The hGetContents function can't behave the way you want, because it's
defined to return the entire rest of the input stream.
If you want to stick with strict ByteStrings, use hGetNonBlocking
instead, but you'll need to block between reads of the handle yourself,
using System.IO.hWaitForInput.
Otherwise, use lazy ByteStrings. That version of hGetContents will
lazily yield chunks that are as big as can be read without blocking as
they arrive (up to a limit of 64KB), and will hWaitForInput for you.
<b
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe