if (!socket.isConnected()) {
System.out.println("CONNECTION DROPPED");
server.handlers.remove(this);
}
if (socket.isInputShutdown()) {
System.out.println("INPUT SHUTDOWN");
}
if (socket.isOutputShutdown()) {
System.out.println("OUTPUT SHUTDOWN");
}
if (!socket.isBound()) {
System.out.println("NOT BOUND");
} //4 methods I found in the java doc for the Socket clas
So I have 4 if statements that presumably check if a socket is shut down. Unfortunately, when I kill one of my netcat test client instances, none of these if statements return a positive. Am I using these functions wrong, or is there some other function that achieves the purpose I seek?
I know that it must be possible to detect a dropped connection, as when I kill the server, all of my netcat clients know this and cease their function. I just can't seem to detect when a Client dies.
For those who aren't familiar with netcat, all it is is a simple program that can send messages across ports (at least, I think that's all it is).







