diff options
Diffstat (limited to 'testsuite/tests/lib/socket/socket005.hs')
-rw-r--r-- | testsuite/tests/lib/socket/socket005.hs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/tests/lib/socket/socket005.hs b/testsuite/tests/lib/socket/socket005.hs new file mode 100644 index 0000000000..ec504aa480 --- /dev/null +++ b/testsuite/tests/lib/socket/socket005.hs @@ -0,0 +1,37 @@ +{- server + +Server as net001 but for Unix Domain Datagram sockets. + +TESTS: + socket + bindSocket + readSocket + +-} + + +module Main where + +import SocketPrim + + +main = + socket AF_UNIX Datagram 0 >>= \ s -> + bindSocket s (SockAddrUnix "sock") >> + + let + loop = + putStr "*** Start of Transfer ***\n" >> + let + read_all = + readSocket s 1024 >>= \ (str, nbytes) -> + if nbytes /= 0 then + putStr str >> + read_all + else + putStr "\n*** End of Transfer ***\n" + in + read_all + in + loop + |