3 As for net002 but reads port number and message as arguments.
4 It also prints out the IP number of the peer machine.
13 module Main(main) where
19 starbuck = "130.209.240.81"
20 marcus = "130.209.247.2"
22 nauru = "130.209.247.5" -- Linux 2.0.30 (RH-4.2) x86
23 easter = "130.209.247.6" -- Linux 2.0.30 (RH-4.2) x86
27 getArgs >>= \ [port, message] ->
28 socket AF_INET Stream 6 >>= \ s ->
29 inet_addr easter >>= \ i_addr ->
30 connect s (SockAddrInet (mkPortNumber (read port)) i_addr) >>
32 getPeerName s >>= \ (SockAddrInet p haddr) ->
33 inet_ntoa haddr >>= \ a ->
34 putStr ("Connected to : " ++ a ++ "\n") >>
35 writeSocket s message >>
36 shutdown s ShutdownBoth >>