[Haskell-cafe] Simple binary-protocol through network test

Daniel Fischer daniel.is.fischer at web.de
Wed Apr 7 15:53:20 EDT 2010


Am Mittwoch 07 April 2010 20:43:24 schrieb Yves Parès:
> Yes, from what I read, I assumed it had this behavior.
> But, then, I don't see why the server holds...
> I've posted a mail on Haskell-Cafe called "Network: buffering troubles",
> in which I put a smaller example which reproduces this problem.

I know :)

I have now tested it, with both (simple) servers and I can't reproduce the 
problem (ghc-6.12.1 and ghc-6.10.3).

0) compile everything with -O2 (I always do, but for testing purposes I've 
also compiled the servers without optimisations for the lazy ByteStrings)

1) start server

2) start client

3) server prints
Chunk "\NUL\NUL\NUL\NUL\NUL\NUL\NUL\ETX" Empty
("\NUL\NUL\NUL\NUL\NUL\NUL\NUL\ETX" for [Char]-IO)
resp.
(3,4,5)
and exits

4) press return to shut down client

Only with strict ByteStrings does the server wait until I shut down the 
client before printing "\NUL\NUL\NUL\NUL\NUL\NUL\NUL\ETX" and exiting, but 
that is to be expected, isn't it?

>
> Daniel Fischer-4 wrote:
> > That shouldn't cause problems. When less than the default chunk size
> > is available, it makes a chunk of what it got and tries to get more
> > later (unless it found EOF, then it closes the handle).
>
> -----
> Yves Parès
>
> Live long and prosper



More information about the Haskell-Cafe mailing list