[clean-list] question about Clean example: Tcp Examples-dowloadHTTP
Paul de Mast
demast.pjf at avans.nl
Wed Oct 20 17:56:19 MEST 2004
Hello,
In the Clean distribution an example can be found for using the Tcp
library:
{Clean 2.1.0}\Examples\Tcp Examples 1.2.4\downloadHTTP
I tried to extend this example with sending multiple commands to a
server, but without any luck. Below is my attempt.
I only get a response for command1 and not command 2.
When exchanging send1-receive1 and send2-receive2 this results in only
a response for command2 and not command1.
Also using:
nsend
[ toByteSeq (httpCommand path1)
, toByteSeq (httpCommand path2)
]
sc env
and repeating receive_MT until (eom rc env) results in (True,rc,env)
does not give me the desired result.
Does anyone have a hint for me?
regards,
Paul de Mast
// Only changed or inserted code is shown:
server :== "www.cs.kun.nl"
path1 :== "/~clean/" // the Clean homepage
path2 :== "/Sparkle/" // the Sparkle homepage
httpCommand1 = "GET "+++path1+++" HTTP/1.0\xD\xA\xD\xA"
httpCommand2 = "GET "+++path2+++" HTTP/1.0\xD\xA\xD\xA"
// send http command1:
(sc, world) = send
(toByteSeq httpCommand1) sc world
// receive answer1:
(tReport, mbBs, rc, world) = receive_MT (Just
(20*ticksPerSecond)) rc world
console = case tReport of
TR_Success ->
fwrites (toString (fromJust mbBs)) console
_ ->
fwrites (server+++" does not send anything (timeout expired)")
console
// send http command2:
(sc, world) = send
(toByteSeq httpCommand2) sc world
// receive answer2:
(tReport, mbBs, rc, world) = receive_MT (Just
(20*ticksPerSecond)) rc world
console = case tReport of
TR_Success ->
fwrites (toString (fromJust mbBs)) console
_ ->
fwrites (server+++" does not send anything (timeout expired)")
console
-------------- next part --------------
A non-text attachment was scrubbed...
Name: downloadHTTP.icl
Type: application/octet-stream
Size: 2391 bytes
Desc: not available
Url : http://mailman.science.ru.nl/pipermail/clean-list/attachments/20041020/23e288e7/downloadHTTP.obj
More information about the clean-list
mailing list