[Haskell-cafe] hSetBuffering woes

Tomasz Zielonka tomasz.zielonka at gmail.com
Sat Jun 16 12:12:06 EDT 2007


On Sat, Jun 16, 2007 at 04:17:39PM +0100, Eric wrote:
> import Network
> import System.IO
> import Data.ByteString as Bits(ByteString,  hGetContents)
> 
> soc <- listenOn $ PortNumber 2007
> (hdl, host, port) <- accept soc
> hSetBuffering hdl No Buffering;
> bs <- Bits.hGetContents hdl;  -- blocks here despite previous line

I think it's because you are using the strict ByteString module version.
Its hGetContents just has to the whole input. Try with
Data.ByteString.Lazy.

Best regards
Tomek


More information about the Haskell-Cafe mailing list