Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

configuring TCP keep alive in java on windows platform

806574Oct 19 2010 — edited Oct 21 2010
By default, the TCP keep alive time seems to be about 2 hrs(http://download-llnw.oracle.com/javase/6/docs/api/java/net/SocketOptions.html#SO_KEEPALIVE). I want to configure it to a lower value so that the connection is not closed by routers/firewalls assuming the connection to be idle. Updating the following registry settings on windows and restarting the machine seems to work.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\KeepAliveTime 30000
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\KeepAliveInterval 1000
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\TcpMaxDataRetransmission 10

Is there a standard way in which the keep alive time can be configured on all OS platforms?

If not, is this a standard way of changing keep alive time for java applications on windows?

Is it necessary that the machine be restarted on changing keep alive time or is there a specific time by which the new keep alive time would be picked up during run time or on restarting the java application?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 18 2010
Added on Oct 19 2010
7 comments
3,366 views