3 The purpose of this test driver is to test TCP Stream sockets.
4 All values have been hard coded since the BSD library is not used to
5 query the databases for the values. In therory this code is thus not
6 portable but net007/Main.hs provides a portable version using the BSD
9 This creates a stream socket bound to port 5000 and waits for incoming
10 messages it then reads all available data before closing the
11 connection to that peer.
13 No form of error checking is provided other than that already provided
33 s <- socket AF_INET Stream 6
34 bindSocket s (SockAddrInet (mkPortNumber 5000) iNADDR_ANY)
39 accept s >>= \ (s',peerAddr) ->
40 putStr "*** Start of Transfer ***\n" >>
43 readSocket s' 4 >>= \ (str, nbytes) ->
48 putStr "\n*** End of Transfer ***\n" >>