Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Main where
- import Network
- import Control.Concurrent
- import System.IO
- main = withSocketsDo $ do
- handle <- connectTo "localhost" (PortNumber 8000)
- hSetBuffering handle LineBuffering
- forkIO $ loopRead handle
- loopWrite handle
- hClose handle
- loopWrite handle = do
- line <- getLine
- hPutStrLn handle line
- loopWrite handle
- loopRead handle = do
- line <- hGetLine handle
- putStrLn line
- loopRead handle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement