// For accept private TransportAsyncWorker(ITransport transport, OperationType operation, AsyncCallback callback, object state) { _transport = transport; _operation = operation; _callback = callback; _result = new TransportAsyncResult(this, state); }
public void EndSend(IAsyncResult result) { TransportAsyncResult asyncResult = (TransportAsyncResult)result; asyncResult.AsyncWaitHandle.WaitOne(); Exception ex = asyncResult.Worker.Exception; if (ex != null) { throw ex; } }
public int EndReceive(IAsyncResult result) { TransportAsyncResult asyncResult = (TransportAsyncResult)result; asyncResult.AsyncWaitHandle.WaitOne(); Exception ex = asyncResult.Worker.Exception; if (ex != null) { throw ex; } return(asyncResult.Worker.BytesReceived); }
public ITransport EndAccept(IAsyncResult result) { TransportAsyncResult asyncResult = (TransportAsyncResult)result; asyncResult.AsyncWaitHandle.WaitOne(); Exception ex = asyncResult.Worker.Exception; if (ex != null) { throw ex; } return(asyncResult.Worker.AcceptedConnection); }