public TryReceiveRequestAsyncResult(TimeSpan timeout, SizedTcpReplyChannel channel, AsyncCallback callback, object state) : base(callback, state) { this.channel = channel; bool completeSelf = true; if (!channel.IsDisposed) { try { IAsyncResult beginReceiveRequestResult = this.channel.BeginReceiveRequest(timeout, OnReceiveRequest, this); if (beginReceiveRequestResult.CompletedSynchronously) { CompleteReceiveRequest(beginReceiveRequestResult); } else { completeSelf = false; } } catch (TimeoutException) { } } if (completeSelf) { base.Complete(true); } }
public ReceiveRequestAsyncResult(TimeSpan timeout, SizedTcpReplyChannel channel, AsyncCallback callback, object state) : base(callback, state) { this.channel = channel; this.timeout = timeout; if (!channel.IsDisposed) { IAsyncResult receiveMessageResult = channel.BeginReceiveMessage(timeout, OnReceiveMessage, this); if (!receiveMessageResult.CompletedSynchronously) { return; } CompleteReceiveMessage(receiveMessageResult); } base.Complete(true); }
public SizedTcpRequestContext(SizedTcpReplyChannel replyChannel, Message requestMessage, TimeSpan timeout) { this.replyChannel = replyChannel; this.requestMessage = requestMessage; this.timeout = timeout; }