makefile fix and table with results so far added to ex3
[tt2015.git] / a3 / code / clean-tcptest / tcpiptest.icl
1 module tcpiptest
2
3 import StdEnv
4 import StdIO
5 import StdMaybe
6 import TCPIP
7
8 hostIP = "127.0.0.1"
9 hostPort = 1203
10
11 :: *Val = String
12 :: *State :== PSt Val
13
14 handleComs con st = (con``, st``) where
15 (con`, st`) = send "Hello World!\n" con st
16 (con``, st``) = send "More text here!\n" con` st`
17
18 Start world = case to of
19 TR_Success = handleComs (toStringSChannel con.sChannel) st`
20 _ = abort "CONNECTION ERROR"
21 where
22 (Just adr, st) = lookupIPAddress hostIP world
23 (to, mcon, st`) = connectTCP_MT Nothing (adr,hostPort) st
24 (Just con) = mcon