How to properly close a socket after an exception is caught?
Posted
by marco
on Stack Overflow
See other posts from Stack Overflow
or by marco
Published on 2010-02-08T12:01:23Z
Indexed on
2010/04/07
7:33 UTC
Read the original article
Hit count: 377
Hello,
after my last project I had the problem that the client was expecting an object from the server, but while processing the clients input an exception that forces the server to close the socket for security reasons is caught.
This causes the client to terminate in a very unpleasant way, the way I decided to deal with this was sending the client a Input status message after each recieved input so that he knows if his input was processed properly or if he needs to throw an exception.
So my question:
- Is there a better/cleaner way to close the socket after an exception is caught??
thanks,
© Stack Overflow or respective owner