[clean-list] question about Clean example: TcpExamples-dowloadHTTP

Paul de Mast demast.pjf at avans.nl
Fri Oct 22 10:17:35 MEST 2004


Hello Arjan,

Oops , my mistake. Thank you for the information. 

I tried to use HTTP/1.1 protocol for a persistent connection.  It didn't
work with my tests:

server  :== "www.cs.kun.nl";
path2   :== "/~clean/"      // the Clean homepage

path1   :== "/Sparkle/"     // the Sparkle homepage

httpCommand1=   "GET "  +++ path1 +++" HTTP/1.1\xD\xA" 
        +++ "HOST: " +++ server +++"\xD\xA\xD\xA"

httpCommand2=   "GET "  +++ path2 +++" HTTP/1.1\xD\xA" 
        +++ "HOST: " +++ server +++"\xD\xA\xD\xA"

But it seems that with server www.cs.kun.nl this does not work.

With another test, it did work:

server  :== "home.aim.avans.nl"
path1   :== "/cojh/"        // Joop's homepage

path2   :== "/cojh/Softwareengineering/seindex.htm" // Joop's SE page


regards,

Paul

>>> Arjen van Weelden <A.vanWeelden at cs.ru.nl> 21-10-2004 15:57:18 >>>
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