Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to make multiple query by http package?

39 views
Skip to first unread message

Hans

unread,
May 17, 2013, 3:57:06 PM5/17/13
to
Hi,
I'm learning to use http package.

I already have a web service running on my server, now I need tcl http client to setup connection to server, then query server, get response, again and again, finally, close the connection.

The all examples I found from internet is one query per connection. From manual:
The ::http::geturl command blocks until the operation completes, unless the -command option specifies a callback that is invoked when the HTTP transaction completes.
I don't know what's the real meaning of "operation completes" or "transaction completes". per network sniffer, I noticed the command quit only after server side close the tcp connection.

what I want to do is something like:
::http::config -proxyhost 1.2.3.4 -proxyport 80 -useragent httppost
set token1 [::http::geturl $url -query $data1 -channel $out -keepalive 1 ]
set token2 [::http::geturl $url -query $data2 -channel $out -keepalive 1 ]
set token3 [::http::geturl $url -query $data3 -channel $out -keepalive 1 ]
set token4 [::http::geturl $url -query $data4 -channel $out -keepalive 1 ]
::http::reset token4 >>>>>>close tcp connection.

Can anybody give me an idea about how to do this? thanks a lot!

Alexandre Ferrieux

unread,
May 17, 2013, 4:44:36 PM5/17/13
to
Recent versions of the http package (at least the one in 8.6 trunk)
have a -keepalive flag.
To force the close at the end, configure the last request without the
flag.

-Alex

Hans

unread,
May 17, 2013, 8:22:56 PM5/17/13
to
Hi Alex,

Thanks for your response.

I already add -keepalive flag. I noticed it has "Connection: keep-alive" in http header. the problem now is "::http:geturl" does not return after it got transaction response, it only return until server side expire and close the connection. I guess I missed a flag but I don't know which one.

thanks again.

Hans

unread,
May 17, 2013, 9:01:29 PM5/17/13
to
Hi, I found one stupid mistake in my code, now it works.
Thank you very much!
0 new messages