Tue, 29 Apr 2003 18:09:42 +0200
This is a multi-part message in MIME format.
Content-Type: text/plain; charset=us-ascii; format=flowed
The attached short program (compile with "ghc VServer.hs -o v -package net")
is supposed to set up a server on port 15151, wait for a connection, read
the first character from the connection, and print it out. Unfortunately
if I test it, by running it, and starting up "telnet [machine] 15151"
somewhere else, and then type some random text, EG "foo[RETURN]", it does
not work. It looks as if the problem is that VServer.hs issues the
hSetBuffering handle (BlockBuffering (Just 4096))
on the connection, because when I change it to
hSetBuffering handle NoBuffering
the program works.
However this is not what I want to do!! Because setting NoBuffering on the
handle is going to mean that when the Server *outputs* something, it will
potentially be done very expensively character by character. How do I
get block buffering on the Server's output, but not have input to the
server held up?
The same thing seems to happen with client Handles by the way.