[Haskell-cafe] Network: buffering troubles

Yves Parès limestrael at gmail.com
Wed Apr 7 11:22:11 EDT 2010


Apparently, the trouble seems to come from binary deserialization.

When I read my handle with:
inp <- L.hGet hdl 24
and no longer with:
inp <- L.hGetContents hdl
I get a lazy bytestring which is no longer infinite, and then
deserialization occurs right.
It proves that at the time of deserialization, the server has all the data
it needs, and should not hold.

I usually don't know the size of the structures I receive through network. I
only know their type, and this should be sufficient for Data.Binary.decode,
since it knows how to work with lazy bytestrings.

Apparently, this example shows no problem with GHC 6.10.

I think that network+binary is quite a common combination in Haskell, so is
there anyone here who also uses GHC 6.12 and has this problem?


Yves Parès wrote:
> 
> Hello,
> 
> I have isolated a problem when using (lazy) ByteStrings through the
> network (GHC 6.12.1, Ubuntu 9.10 32bits):
> 
> Here is my client:  http://old.nabble.com/file/p28162932/Client.hs
> Client.hs 
> And my server:  http://old.nabble.com/file/p28162932/Server.hs Server.hs 
> 
> The server holds until the client closes the connection, even if I flush
> the handle on the client side after writing or even if I turn off
> buffering on both sides.
> 


-----
Yves Parès

Live long and prosper
-- 
View this message in context: http://old.nabble.com/Network%3A-buffering-troubles-tp28162932p28166613.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list