After my last project, I had a problem that the client was expecting an object from the server, but an exception was thrown when processing clients, forcing the server to close the socket for security reasons.
This leads to the fact that the client ends in a very unpleasant way, since I decided to deal with this, it is to send the client a message about the input status after each input received, so that he knows whether his input is processed correctly or if he needs an exception.
So my question is:
- Is there a better / cleaner way to close a socket after throwing an exception?
source
share