This question and answer解释了如何以编程方式设置不安全背景颜色,但是当我使用这种方法时,它不会更改底部不安全区域的背景颜色。只会更改不安全的顶部背景颜色。
我正在使用的当前代码似乎只会更改最不安全的背景颜色。
read() will return -1
readLine() returns null
readXXX() for any other X throws EOFException.
The only really reliable way to detect a lost TCP connection is to write to it. Eventually this will throw an IOException: connection reset, but it takes at least two writes due to buffering.