Exemplo n.º 1
0
        void BuildResponse(ReaderStateObject stateObj)
        {
            bool needMoreData = true;

            stateObj.UpdateContext();
            do
            {
                ParseExistentData();
                if (_response.IsCompleted)
                {
                    stateObj.SetCompleted();
                    needMoreData = false;
                    break;
                }
            } while(_linesBuilder.Available > 0);

            if (needMoreData)
            {
                //start reading response
                _socket.BeginReceive(_recvBuffer,
                                     0,
                                     _recvBuffer.Length,
                                     new AsyncCallback(this.OnRecieved),
                                     stateObj);
            }
        }