答案 0 :(得分:1)
尝试使用此:http://docs.oracle.com/javase/7/docs/api/java/net/Socket.html#setKeepAlive(boolean)。
public void setKeepAlive(boolean on)
throws SocketException
Enable/disable SO_KEEPALIVE.
Parameters:
on - whether or not to have socket keep alive turned on.