Ejemplo n.º 1
0
        void Accept_Read_End(IAsyncResult ar)
        {
            Accept_SO stateObj = (Accept_SO)ar.AsyncState;

            try
            {
                stateObj.UpdateContext();
                stateObj.ReadBytes += NStream.EndRead(ar);

                if (stateObj.ReadBytes < 8)
                {
                    //------------------------------------
                    // Continue read the response from proxy server.
                    //
                    NStream.BeginRead(_response,
                                      stateObj.ReadBytes,
                                      8 - stateObj.ReadBytes,
                                      new AsyncCallback(Accept_Read_End),
                                      stateObj);
                }
                else
                {
                    VerifyResponse();
                    stateObj.SetCompleted();
                }
            }
            catch (Exception e)
            {
                stateObj.Exception = e;
                stateObj.SetCompleted();
            }
        }
Ejemplo n.º 2
0
        override internal IAsyncResult BeginAccept(AsyncCallback callback,
                                                   object state)
        {
            CheckDisposed();

            Accept_SO stateObj = null;

            SetProgress(true);
            try
            {
                stateObj = new Accept_SO(callback, state);

                //------------------------------------
                // Read the second response from proxy server.
                //
                NStream.BeginRead(_response,
                                  0,
                                  8,
                                  new AsyncCallback(Accept_Read_End),
                                  stateObj);
            }
            catch
            {
                SetProgress(false);
                throw;
            }
            return(stateObj);
        }
Ejemplo n.º 3
0
        private void Accept_Read_End(IAsyncResult ar)
        {
            Accept_SO asyncState = (Accept_SO)ar.AsyncState;

            try
            {
                asyncState.UpdateContext();
                byte[] reply = this.EndReadVerifyReply(ar);
                this._remoteEndPoint = this.ExtractReplyAddr(reply);
            }
            catch (Exception exception)
            {
                asyncState.Exception = exception;
            }
            asyncState.SetCompleted();
        }
Ejemplo n.º 4
0
        internal override IAsyncResult BeginAccept(AsyncCallback callback, object state)
        {
            base.CheckDisposed();
            Accept_SO t_so = null;

            this.SetProgress(true);
            try
            {
                t_so = new Accept_SO(callback, state);
                this.BeginReadVerifyReply(new AsyncCallback(this.Accept_Read_End), t_so);
            }
            catch
            {
                this.SetProgress(false);
                throw;
            }
            return(t_so);
        }
        private void Accept_Read_End(IAsyncResult ar)
        {
            Accept_SO asyncState = (Accept_SO)ar.AsyncState;

            try
            {
                asyncState.UpdateContext();
                asyncState.ReadBytes += base.NStream.EndRead(ar);
                if (asyncState.ReadBytes < 8)
                {
                    base.NStream.BeginRead(this._response, asyncState.ReadBytes, 8 - asyncState.ReadBytes, new AsyncCallback(this.Accept_Read_End), asyncState);
                }
                else
                {
                    this.VerifyResponse();
                    asyncState.SetCompleted();
                }
            }
            catch (Exception exception)
            {
                asyncState.Exception = exception;
                asyncState.SetCompleted();
            }
        }
Ejemplo n.º 6
0
        override internal IAsyncResult BeginAccept(
            AsyncCallback callback, 
            object state)
        {
            CheckDisposed();

            Accept_SO stateObj = null;
            SetProgress(true);
            try
            {
                stateObj = new Accept_SO(callback, state);

                //------------------------------------
                // Read the second response from proxy server. 
                //
                NStream.BeginRead(
                    _response, 
                    0, 
                    8, 
                    new AsyncCallback(Accept_Read_End),
                    stateObj);
            }
            catch
            {
                SetProgress(false);
                throw;
            }

            return stateObj;
        }