Hi all,
I am writing a networked application in Java, to communicate between the Client and the Server I am using Serialized objects to represent data/commands and sending them through object output/input streams.
I am having problems cleanly closing the Connections, I assume that I am missing something fundamental that I do not really know about, I've never used sockets with serialization before.
What ever order I try to shutdown the connection (close client first, close server first) a ConnectionReset exception is thrown. I cannot catch this exception as the client runs in another thread to the rest of the program constantly listening for messages, this must be done, as in java socket.read() is a blocking method.
What is the correct way to close a socket that I am using to send objects?