public EndReceive ( IAsyncResult asyncResult ) : int | ||
asyncResult | IAsyncResult |
/// An
/// |
리턴 | int |
void Read_End(IAsyncResult ar) { Read_SO stateObj = (Read_SO)ar.AsyncState; try { stateObj.UpdateContext(); int read = _socket.EndReceive(ar); stateObj.Read += read; if ((read > 0) && (stateObj.Read < stateObj.Size)) { _socket.BeginReceive( stateObj.Buffer, stateObj.Offset + stateObj.Read, stateObj.Size - stateObj.Read, new AsyncCallback(Read_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(); * } */ }