public override void EndWrite(IAsyncResult asyncResult) { try { socket.EndSend(asyncResult); } catch (Exception ex) { if (ex is ThreadAbortException || ex is StackOverflowException || ex is OutOfMemoryException) { throw; } throw new IOException(ex.Message, ex); } }