0

I'm having issues understand what I have to do in a particular secinaro in java.

I have a client socket that connects to a port on another machine. When the service that is running on the remote machine, is killed the connection is broken on one of the endpoints. However when I query my socket about this, it tells me that it is still connected, open etc.

When I do a "netstat -nap | grep " I can see that the port number is in a state of CLOSE_WAIT, which means that the connection has been closed on one end. How can my client query the other end of the connection and determine that the pipe is now broke?

I'm confused as to why, when I query the socket on methods like isConnected, isClosed etc. the result still tells me the connection is open.

Thanks for any help :)

GBlodgett
  • 12,704
  • 4
  • 31
  • 45
Tom McG
  • 31
  • 6

1 Answers1

0

You seem to know well the state of the socket. You probably also have gotten the streams dried out/EOF. The only thing left you might have forgotten is to socket.close() (preferably after both in/out were closed).

user2023577
  • 1,752
  • 1
  • 12
  • 23