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
- sock <- listenOn (PortNumber 8000)
- loop sock
- sClose sock
- loop sock = do
- conn <- accept sock
- forkIO $ process conn
- loop sock
- process (handle, name, port) = do
- hSetBuffering handle LineBuffering
- hPutStrLn handle "Hello"
- s <- hGetLine handle
- hPutStrLn handle s
- hClose handle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement