X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=Devices%2FmTaskTCP.icl;h=4ebc1ac223898681f3825acaf209806d8eebde19;hb=a2df77cbda43d5a24eeb8ac7db7452baae9f18aa;hp=52832d6778a8e6d7fb50ef619d5ed8516dac2bd5;hpb=1827e72942a355fc90dcb4e0b93f68c98dc6eea5;p=mTask.git diff --git a/Devices/mTaskTCP.icl b/Devices/mTaskTCP.icl index 52832d6..4ebc1ac 100644 --- a/Devices/mTaskTCP.icl +++ b/Devices/mTaskTCP.icl @@ -23,7 +23,7 @@ instance MTaskDuplex TCPSettings where onDisconnect=onDisconnect} @! () where onConnect :: String ([MTaskMSGRecv],[MTaskMSGSend],Bool) -> (MaybeErrorString String, Maybe ([MTaskMSGRecv],[MTaskMSGSend],Bool), [String], Bool) - onConnect acc (msgs,send,sendStopped) = (Ok acc, Just (msgs,[],sendStopped), map encode send, False) + onConnect acc (msgs,send,sendStopped) = (Ok "", Just (msgs,[],sendStopped), map encode send, False) whileConnected :: (Maybe String) String ([MTaskMSGRecv], [MTaskMSGSend],Bool) -> (MaybeErrorString String, Maybe ([MTaskMSGRecv],[MTaskMSGSend],Bool), [String], Bool) //We stop @@ -37,9 +37,11 @@ instance MTaskDuplex TCPSettings where = (Ok acc, Just (msgs++map decode nd,[],sendStopped), map encode send, False) process :: String -> (String, [String]) - process s = case indexOf "\n" s of + process s + | not (trace_tn ("process: " +++ toString (toJSON s))) = undef + = case indexOf "\n" s of -1 = (s, []) - i = appSnd (\ss->[s % (0,i):ss]) (process (s % (i+1, size s))) + i = appSnd (\ss->[s % (0,i-1):ss]) (process (s % (i+1, size s))) onDisconnect :: String ([MTaskMSGRecv],[MTaskMSGSend],Bool) -> (MaybeErrorString String, Maybe ([MTaskMSGRecv],[MTaskMSGSend],Bool)) onDisconnect _ (msgs,send,sendStopped) = (Ok "", Nothing)