public EndSend ( IAsyncResult asyncResult ) : int | ||
asyncResult | IAsyncResult |
/// An
/// |
return | int |
void Send_End(IAsyncResult ar) { Write_SO stateObj = (Write_SO)ar.AsyncState; try { stateObj.UpdateContext(); int sent = _socket.EndSend(ar); stateObj.Sent += sent; if (stateObj.Sent < stateObj.Size) { _socket.BeginSend( stateObj.Buffer, stateObj.Offset + stateObj.Sent, stateObj.Size - stateObj.Sent, new AsyncCallback(Send_End), stateObj); } else { stateObj.SetCompleted(); } } catch (Exception e) { if (_disposed) { stateObj.Exception = GetDisposedException(); } else { stateObj.Exception = e; } stateObj.SetCompleted(); } /* * catch * { * if(_disposed) * stateObj.Exception = GetDisposedException(); * else * stateObj.Exception = new SocketException(SockErrors.WSAECONNRESET); * stateObj.SetCompleted(); * } */ }