>>> Sujoy <[EMAIL PROTECTED]> 22-Jan-01 1:21:10 PM >>>
>Actually, I am working on performance issues .
>In my servlet there are so many redirects so I was
>wondering whether JRun closes the socket conn.
>after the redirection.
You'll have to ask Allaire whether they implement connection
keep-alives or not (or you could just send a request to the servlet
engine and see what you get in response).
>Right now I have written a socket and used the
>req. header Connection : Keep-Alive(HTTP/1.0 only ) .
Do you mean you've written a client which uses Sockets to implement
HTTP with keep-alives?
>And used the same client socket for next request .
>It worked fine. But the problem is, when you use
>"Connection : Keep-Alive" req. header the web-server
>does not send null as a termination of the response string
Not quite true. It's just that it's impossible to tell whether that
null is important or not. Thus content-lengths are necessary for
connection re-use.
>so my loop doesnot get terminated. And this means I
>have to set the content length header and check that too.
So?
>So that means is I set Connection : Keep-Alive web server
>does not close the socket .
Huh? You close the socket by sending a request without the:
Connection: keep-alive
header. When the server recieves such a line it knows the socket must
die.
So it seems simple:
- use connection re-use
- set content-lengths in your servlet and in your client
- end the connection re-use by NOT sending the
"Connection: keep-alive"
header.
An alternative (if you are writing your own client) is to use the
HTTP/1.1 protocol and chunked encoding. This means that you don't have
to set response content-lengths (because the content is chunked into
blocks). You still have to set content-lengths on requests though.
Nic Ferrier
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html