close只是通知虚拟机断开连接,但在缓冲区中还有数据的情况下,由虚拟机判断这次传输完毕才能断开,你用close()无法控制。
非要强行断开要用
shutdownInput() /shoudownOutput!
不过不常用。

解决方案 »

  1.   

    那就是说用shudownInput(),不安全?可能丢失数据?那close()最多在多久后能关掉socket?
      

  2.   

    关掉输入输出流后,是否socket会自动关闭?即程序中的:
        socketWriter.close();
        socketReader.close();
      

  3.   

    client.close()调用过后client就会为null吗?
    if (client != null)
       System.out.println("the socketclient have wrong");
    难道client不为null,就说明它没有close()?
    请恕我才疏学浅,呵呵~~