public IAsyncResult BeginReceiveRequest(TimeSpan timeout, AsyncCallback callback, object state)
            {
                ReceiveRequestAsyncResult result = new ReceiveRequestAsyncResult(this, timeout, callback, state);

                result.Begin();
                return(result);
            }
            static void OnReceiveRequest(IAsyncResult result)
            {
                if (result.CompletedSynchronously)
                {
                    return;
                }

                ReceiveRequestAsyncResult thisPtr = (ReceiveRequestAsyncResult)result.AsyncState;
                Exception completionException     = null;

                try
                {
                    thisPtr.OnReceiveRequestCore(result);
                }
                catch (Exception e)
                {
                    completionException = e;
                }

                thisPtr.Complete(false, completionException);
            }
                public static RequestContext End(IAsyncResult result)
                {
                    ReceiveRequestAsyncResult thisPtr = AsyncResult.End <ReceiveRequestAsyncResult>(result);

                    return(thisPtr.RequestContext);
                }
 public RequestContext EndReceiveRequest(IAsyncResult result)
 {
     return(ReceiveRequestAsyncResult.End(result));
 }