summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/lib/socket/socket002.hs
blob: 1e7b19da0b9d760e61b7cc88ed68fb43b8c05b1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{- client

Client side to net001/Main.hs.

Note that the machine IP numbers have been hard coded into this
program so it is unlikely that you will be able to run this test if
you are not at dcs.gla.ac.uk :-(

The reason for this is to aviod using the BSD module at this stage of
testing.


TESTS:
    socket
    connect
    writeSocket
    shutdown
    inet_addr
-}


module Main where

import SocketPrim


starbuck    = "130.209.240.81"		-- SunOS 4.1.3 1 sun4c
marcus	    = "130.209.247.2"		-- SunOS 4.1.3 6 sun4m
avon	    = "130.209.247.4"		-- OSF1 V2.0 240 alpha
karkar	    = "130.209.247.3"		-- OSF1 V2.0 240 alpha
nauru	    = "130.209.247.5"		-- Linux 2.0.30 (RH-4.2) x86
easter	    = "130.209.247.6"		-- Linux 2.0.30 (RH-4.2) x86

message	    = "Hello World"


main =
    socket AF_INET Stream 6				>>= \ s ->
    inet_addr easter					>>= \ ia ->
    connect s (SockAddrInet (mkPortNumber 5000) ia)     >>
    
    writeSocket s message				>>
    shutdown s ShutdownBoth				>>
    sClose s