我在写一个聊天程序,当客户端退出程序时,服务器要如何知道客户端已退出??我写了两个类来测试如何检测到客户端的Socket已close...如下://服务器测试类
public class TestServerSocket {

public static void main(String args[]){
ServerSocket server = null;
Socket client = null;
InputStream in = null;
OutputStream out = null;


try {
server = new ServerSocket(1000);
client = server.accept();
System.out.println("已建立连接");
in = client.getInputStream();
out = client.getOutputStream();

while(true){
if(client.isClosed()){
System.out.println("client is close!!");
break;
}
if(!client.isConnected()){
System.out.println("client is not connected!!");
break;
}
if(!client.isBound()){
System.out.println("client is not bound!!");
break;
}
}
} catch (IOException e) {
e.printStackTrace();
}

}
}
//客户端测试类
class TestSocket{

public static void main(String args[]){
Socket client = null;

try {
client = new Socket("localhost",1000);
client.close();

} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
client.close();
} catch (IOException e) {
e.printStackTrace();
}
}

}

}我发现在这里对服务器的client用isClose,isConnected,isBound检测不出来??
不知道要如何写才可以??