Exemplo n.º 1
0
        /// <summary>
        /// 重写方法:启动对 HTTP 处理程序的异步调用
        /// </summary>
        /// <param name="context"></param>
        /// <param name="cb">异步方法调用完成时要调用的 AsyncCallback。如果 cb 为 nullNothingnullptrnull 引用(在 Visual Basic 中为 Nothing),则不调用委托</param>
        /// <param name="extraData">处理该请求所需的所有额外数据</param>
        /// <returns></returns>
        public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData)
        {
            //  get the result here
            CometAsyncResult result = new CometAsyncResult(context, cb, extraData);

            result.BeginWaitRequest();

            //  ok, return it
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 重写方法:进程结束时提供异步处理 End 方法
        /// </summary>
        /// <param name="result"></param>
        public void EndProcessRequest(IAsyncResult result)
        {
            CometAsyncResult cometAsyncResult = result as CometAsyncResult;

            if (cometAsyncResult != null && cometAsyncResult.ResponseObject != null)
            {
                cometAsyncResult.HttpContext.Response.Write(cometAsyncResult.ResponseObject);
            }

            cometAsyncResult.HttpContext.Response.End();
        }
Exemplo n.º 3
0
 public CometWaitRequest(CometAsyncResult result)
 {
     this.result = result;
 }