Sujoy wrote:
>
> 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.
>
If you really, really want to know exactly what's
happening, and are willing to learn a little bit
about TCP/IP, then a network sniffer is an invaluable
tool for performance analysis. If you're on a Unix
system, Ethereal[1] works well and has the advantage
of being free (I think it's supposed to work on
Windows too.)
If that's too involved, you might be able to
get what you need using netstat (a unix tool
that lists the current network connections),
I'm sure there's something similiar on Windows.
> Right now I have written a socket and used the
> req. header Connection : Keep-Alive(HTTP/1.0 only ) .
> ...
> so my loop doesnot get terminated. And this means I have to
> set the content length header and check that too.
> So that means is I set Connection : Keep-Alive web server
> does not close the socket .
>
I'm not sure exactly what your question is, so I'll
answer a couple different ones. I'm assuming that you're
talking about writing your own client to talk to the
servlet?
a1) Newer versions of the JDK have built-in support for
persistent connections using HTTP1.1 features, see
the jdk docs for details.
a2) Older versions of the JDK don't, but there are
packages like HTTPClient that add that support. In fact,
HTTPClient (also freely available[2]) is probably worth
checking out in any case.
a3) If you're writing a low-level client to talk to
servlets, then yes, you need to watch the content length,
but it's considerably more complex than that, use a
library like HTTPClient instead. Or get ahold of rfc2616
and go to town, but anything beyond a simple HTTP/1.0
client is more complex than you might think.
-cks
[1] <URL:http://www.ethereal.com/> Very fun to play with
even if you're not having performance problems. Make
every packet count :-)
[2] <URL:http://www.innovation.ch/java/HTTPClient/> It's
GPL'ed, so double check that the licensing terms are
acceptable.
___________________________________________________________________________
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