コード例 #1
0
            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);
                }
            }
コード例 #2
0
            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);
            }
コード例 #3
0
 public SizedTcpRequestContext(SizedTcpReplyChannel replyChannel, Message requestMessage, TimeSpan timeout)
 {
     this.replyChannel   = replyChannel;
     this.requestMessage = requestMessage;
     this.timeout        = timeout;
 }
コード例 #4
0
            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);
                }
            }
コード例 #5
0
            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);
            }
コード例 #6
0
 public SizedTcpRequestContext(SizedTcpReplyChannel replyChannel, Message requestMessage, TimeSpan timeout)
 {
     this.replyChannel = replyChannel;
     this.requestMessage = requestMessage;
     this.timeout = timeout;
 }