Sockets again

George Russell ger@tzi.de
Tue, 29 Apr 2003 19:04:42 +0200


Keean Schupke wrote:> Hi,
>    The problem is not with the haskell, but with telnet, which uses line 
> buffered output itself.
> 
> Try the following:
> 
> module Main(main) where
> 
> import IO
> import Network
> 
> main = do
>    socket <- listenOn (PortNumber 15151)
>    (handle,hostName,_) <- accept socket
>    hSetBuffering handle (BlockBuffering (Just 4096))
>    putStr ("Accepted: "++hostName++"\n")
>    c <- hGetLine handle
>    putStrLn (show c)
> 
> telnet to this, type a line and hit return ... should print the line.

I presume this is the same program I sent.  I *did* hit return, so I don't
think that's the problem.