File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes persistent HTTP connections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "persistent HTTP connections" Watch "persistent HTTP connections" New topic

persistent HTTP connections

Sathya Prakasham

Joined: Dec 15, 2001
Posts: 3
Hi All,
I am trying to implement a pushlet model using servlet and I am faced with many technical difficulties to have a scalable
reliable pushlet mechanism which will do event notification to my client Applet.
My questions,
1) My Pushlet design needs a active/persistent HTTP connection through which we can have a callback
mechanism. HTTP1.1 has accomodated persistent connections , but is there any default time-out period after which the
server (weblogic6.1) drops the HTTP connection in case of client being idle for sometime ??
2)If there is timeout option should I do a ping on to server in regular intervals so as to keep the HTTP connection alive with the server. I dont want to do polling , so is there any way I can know the default HTTP time-out option of the server so
that I can do a ping within that interval to keep Connection alive.
3) I cannot use plain persistent Sockets (TCP/IP) because of firewall between client and server ,
Is there anyway I can keep my HTTP-Connection alive with server avoiding the default HTTP-Timeout taking into consideration that
webserver supports HTTP1.1
Any information on these will be of great help and will be appreciated..
Laudney Ren
Ranch Hand

Joined: Jan 06, 2002
Posts: 111
Here is something about TCP KEEP_ALIVE, hopes that will help.
You can turn on the SO_KEEPALIVE option in Socket with jdk1.3 or later by using setKeepAlive(true) on the client side. It'll result int the following consequence:
Every two housrs, the client sends a TCP packet to the Server. If there is proper response (if during the two hours, the server has been restarted, the server will respond to the packet with RESET, which forces the client to close the connection), client will try again two hours later.
If there is no response, the client will send 9 packets over the next period of time with an interval of 75 seconds. If no response is found, the client will close the connection. If there is a proper response, go back to the stage of sending a packet two hours later.

" Veni, vidi, vici "<br />" I came, I saw, I conquered "
I agree. Here's the link:
subject: persistent HTTP connections
It's not a secret anymore!