[clean-list] question about Clean example: Tcp Examples-dowloadHTTP

Arjen van Weelden A.vanWeelden at cs.ru.nl
Thu Oct 21 15:57:18 MEST 2004


Hello,

This is part of the HTTP protocol.

Because it isn't a persistent connection, you have to close the TCP 
channel and start a new connection. You can see that it is not a 
persistent connection because the output from the first request contains 
"Connection: close" in the response header.

regards,
	Arjen

Paul de Mast wrote:

> 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
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> clean-list mailing list
> clean-list at science.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/clean-list


More information about the clean-list mailing list