I am trying test a server where we reduced the keepalive params (default 7200 sec to 300) on RHEL. I was setting:
try {
Socket tstSocket = new Socket(serverName, portNum);
PrintWriter out = new PrintWriter(tstSocket.getOutputStream(), true);
tstSocket.setKeepAlive(true);
and wait 10min and check:
out.println("output");
if (out.checkError()){
System.out.println("Socket closed");
}
But if I set the setKeepAlive to true (should I just take this out?), does this mean the keepalivetime is no longer used? (from the definition below)
tcp_keepalive_time - the interval between the last data packet sent (simple ACKs are not considered data) and the first keepalive probe; after the connection is marked to need keepalive, this counter is not used any further.