Is it ok to Swallow SocketExceptions in some situations? (C#)
- by NoPyGod
Let's say I've programmed an application which connects to a server using the Socket Class (TCP). If I encounter a SocketException while reading or writing, then obviously I have to do go ahead and run a disconnection routine to change the application's state to Disconnected.
But what if I've started to Disconnect, and while I'm cleaning up, a SocketException occurs?
The SocketException doesn't really mean anything to me, as I was going to shutdown the socket myself anyway.. so is it ok to swallow it?
I really want to know what the best practice for this situation is.