Regarding asynchronous I / O using the (bidirectional) NetworkStream MSDN, it says, "EndRead must be called once for every BeginRead call."
Is this true even when EndRead () throws an exception, for example, when NetworkStream was closed after BeginRead () exited?
I don't need the overhead of throwing an exception, but I also don't want the leak of valuable OS resources reserved by BeginRead ().
I also know that a thread can be closed between a thread state test and conditional EndRead (), but if EndRead () can be omitted, when we know that the thread is closed, this will save on exception handling in most cases.
Am I doing it wrong?
Thank!
source
share