
hi guys, I'm newbie, just begin to learn Haskell. now i write a very simple server and client . Server: import Control.Concurrent import System.IO import Network port :: Int port = 1234 main :: IO () main = withSocketsDo $ do s <- listenOn $ PortNumber $ fromIntegral port (h, _, _) <- accept s sline <- hGetLine h hPutStrLn h sline putStrLn $ "send "++sline threadDelay 1000000 hClose h sClose s Client : import System.IO import Network port :: Int port = 1234 main :: IO () main = withSocketsDo $ do h <- connectTo "localhost" $ PortNumber $ fromIntegral port hPutStrLn h "hello" bs <- hGetContents h putStrLn bs hClose h And, it doesn't work now . I run ./serv , then run ./cli , they will block all the time. but, when i run ./serv, and telnet localhost 1234 in another terminal, it works fine. so i don't know what's the wrong with my code. anybody can tell me about my problem? os is Debian 7, haskell-platform 2012.2.0.0 thanks a lot!!! -- K.I.S.S.