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