예제 #1
0
        void Bind_Write_End(IAsyncResult ar)
        {
            Bind_SO stateObj = (Bind_SO)ar.AsyncState;

            try
            {
                stateObj.UpdateContext();
                NStream.EndWrite(ar);

                //------------------------------------
                // Read the response from proxy server.
                //
                NStream.BeginRead(
                    _response,
                    0,
                    8,
                    new AsyncCallback(Bind_Read_End),
                    stateObj);
            }
            catch (Exception e)
            {
                stateObj.Exception = e;
                stateObj.SetCompleted();
            }
        }
        void Connect_Write_End(IAsyncResult ar)
        {
            Connect_SO stateObj = (Connect_SO)ar.AsyncState;

            try
            {
                stateObj.UpdateContext();
                NStream.EndWrite(ar);

                //-----------------------------------------
                // Read the reply
                BeginReadReply(new AsyncCallback(Connect_ReadReply_End), stateObj);
            }
            catch (Exception e)
            {
                stateObj.Exception = e;
                stateObj.SetCompleted();
            }
        }