Caldarale, Charles R wrote:
From: xygnu...@gmail.com [mailto:xygnu...@gmail.com] On Behalf Of Paritosh Patel
Subject: Two way long running servlet connection problem
What am I doing wrong?
For starters, you're not telling us the version of Tomcat in use, the JVM level
it's running in, the platform you're running on, and whether or not Tomcat is
front-ended by any web server, such as httpd or IIS.
Apart from the above, I will put on my RFC hat, and muse a bit about the
general idea.
In HTTP 1.0, the basic scheme was :
- a client establishes a connection with the webserver, and sends a request over this
connection. It then waits for the answer on the same connection.
- the server receives the request, processes it, sends a response over the
connection.
- the client reads the response
- the connection is closed
Repeat for the next request.
In HTTP 1.1, a change was made, with the objective of avoiding the overhead of
establishing/destroying a connection for each request.
A client can establish a connection with the webserver, and request that this connection
be "persistent" (keep-alive).
It then sends a first request on the connection.
The server reads an processes the request, and sends the response.
The client can now send a second request on the same connection.
Repeat.
If the client sends no more requests on the connection, after a suitable timeout, the
server closes the connection.
Now in all that it does not, to my knowledge, specify that on the server side, it will be
the same process which handles all the requests on the same connection.
So maybe your idea of re-using the connection, with the hope of reaching the same
"process" on the server side, is not really guaranteed to work.
Basically what I mean, is that there is not really a provision in the webapp logic, for
processing a second request after it has sent a response to the current one.
In other words, you current scheme seems the right one. Just use a persistent connection,
and the rest will take care of itself.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org