strange behaviour for tcpconnect
When I run this following code without having a server listening on port 9999, it gives the following trace:
("onConnect: ", 0, "127.0.0.1", ())
("onShareChange: ", (), ())
("onDisconnect: ", (), ())
When I run the commented line instead I get this:
Failed to connect to host localhost:9999
I would expect the first case to also return an error.
module test
import iTasks
import StdDebug, Text.GenPrint
Start w = doTasks (onStartup t) w
null :: SDSSource () () ()
null = nullShare
t = tcpconnect "localhost" 9999 (Just 500) null
//t = tcpconnect "localhost" 9999 Nothing null
{ onConnect = \cid host r = trace_n (printToString ("onConnect: ", cid, host, r))
(Ok (), Nothing, [], False)
, onData = \ data l r = trace_n (printToString ("onData: ", data, l, r))
(Ok (), Nothing, [], False)
, onShareChange = \ l r = trace_n (printToString ("onShareChange: ", l, r))
(Ok (), Nothing, [], False)
, onDisconnect = \ l r = trace_n (printToString ("onDisconnect: ", l, r))
(Ok (), Nothing)
, onDestroy = \ l = trace_n (printToString ("onDestroy: ", l))
(Ok (), [])
}