Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

19 lines (16 sloc) 0.567 kb
-- Echo client program
module Main where
import Network.Socket hiding (recv)
import Network.Socket.ByteString (recv, sendAll)
import qualified Data.ByteString.Char8 as C
main :: IO ()
main = withSocketsDo $
do addrinfos <- getAddrInfo Nothing (Just "") (Just "3000")
let serveraddr = head addrinfos
sock <- socket (addrFamily serveraddr) Stream defaultProtocol
connect sock (addrAddress serveraddr)
sendAll sock $ C.pack "Hello, world!"
msg <- recv sock 1024
sClose sock
putStr "Received "
C.putStrLn msg
Jump to Line
Something went wrong with that request. Please try again.