static void OnSend(IAsyncResult result) { if (result.CompletedSynchronously) { return; } SocketSendAsyncResult thisPtr = (SocketSendAsyncResult)result.AsyncState; Exception completionException = null; bool shouldComplete = false; try { if (thisPtr.CompleteSend(result)) { shouldComplete = true; } else { thisPtr.StartSending(); } } catch (Exception e) { completionException = e; } if (shouldComplete) { thisPtr.Complete(false, completionException); } }
static void OnSend(IAsyncResult result) { if (result.CompletedSynchronously) { return; } SocketSendAsyncResult thisPtr = (SocketSendAsyncResult)result.AsyncState; Exception completionException = null; try { thisPtr.CompleteSend(result); } catch (Exception e) { completionException = e; } thisPtr.Complete(false, completionException); }