```java
@Override public void run() { try (InputStream input = this.sock.getInputStream()) { try (OutputStream output = this.sock.getOutputStream()) { handle(input, output); } } catch (Exception e) { try { this.sock.close(); } catch (IOException ioe) { } System.out.println("client disconnected."); } }
```
应该调整输出`client disconnected`位置, 不然非异常退出的时候, 监听不到客户端断开链接, 应改为:
@Override public void run() { try (InputStream input = this.sock.getInputStream()) { try (OutputStream output = this.sock.getOutputStream()) { handle(input, output); } } catch (Exception e) { try { this.sock.close(); } catch (IOException ioe) { } } System.out.println("client disconnected."); }
Sign in to make a reply
早晨听后摇了摇头
```java
```
应该调整输出`client disconnected`位置, 不然非异常退出的时候, 监听不到客户端断开链接, 应改为:
```java
```