C/Linux has the following…
TCP_KEEPCNT (since Linux 2.4)
The maximum number of keepalive probes TCP should send
before dropping the con-
nection. This option should not be used in code intended to
be portable.TCP_KEEPIDLE (since Linux 2.4) The time (in seconds) the connection needs to remain idlebefore TCP starts send-
ing keepalive probes, if the socket option SO_KEEPALIVE
has been set on this
socket. This option should not be used in code intended to
be portable.TCP_KEEPINTVL (since Linux 2.4) The time (in seconds) between individual keepalive probes.This option should
not be used in code intended to be portable.
I know there are portability issues with these but is there anyway to alter these in Java on a Socket?
doesn’t look like something you can readily change from Java, a JNA/JNI wrapper around the C api probably your safest bet.