Ticket #42: socket002.hs

File socket002.hs, 1.0 kB (added by igloo, 3 years ago)
Line 
1{- client
2
3Client side to net001/Main.hs.
4
5Note that the machine IP numbers have been hard coded into this
6program so it is unlikely that you will be able to run this test if
7you are not at dcs.gla.ac.uk :-(
8
9The reason for this is to aviod using the BSD module at this stage of
10testing.
11
12
13TESTS:
14    socket
15    connect
16    writeSocket
17    shutdown
18    inet_addr
19-}
20
21
22module Main where
23
24import SocketPrim
25
26
27starbuck    = "130.209.240.81"          -- SunOS 4.1.3 1 sun4c
28marcus      = "130.209.247.2"           -- SunOS 4.1.3 6 sun4m
29avon        = "130.209.247.4"           -- OSF1 V2.0 240 alpha
30karkar      = "130.209.247.3"           -- OSF1 V2.0 240 alpha
31nauru       = "130.209.247.5"           -- Linux 2.0.30 (RH-4.2) x86
32easter      = "130.209.247.6"           -- Linux 2.0.30 (RH-4.2) x86
33
34message     = "Hello World"
35
36
37main =
38    socket AF_INET Stream 6                             >>= \ s ->
39    inet_addr easter                                    >>= \ ia ->
40    connect s (SockAddrInet (mkPortNumber 5000) ia)     >>
41   
42    writeSocket s message                               >>
43    shutdown s ShutdownBoth                             >>
44    sClose s