看jdk的文档了:
setKeepAlive public void setKeepAlive(boolean on)
throws SocketException Enable/disable SO_KEEPALIVE.Parameters:on - whether or not to have socket keep alive turned on.Throws:SocketException - if there is an error in the underlying protocol, such as a TCP error.Since: 1.3See Also: getKeepAlive()