clean TCPIP library test
[tt2015.git] / a3 / code / clean-tcptest / tcpiptest.icl
1 module tcpiptest
2
3 import StdEnv
4 import StdMaybe
5 import TCPIP
6
7 hostIP = "127.0.0.1"
8 hostPort = 1203
9
10 handleComs con world = (con``, world``) where
11 (con`, world`) = send "Hello World!\n" con world
12 (con``, world``) = send "More text here!\n" con` world`
13
14 Start world = case to of
15 TR_Success = handleComs (toStringSChannel con.sChannel) world``
16 _ = abort "CONNECTION ERROR"
17 where
18 (Just adr, world`) = lookupIPAddress hostIP world
19 (to, mcon, world``) = connectTCP_MT Nothing (adr,hostPort) world`
20 (Just con) = mcon