Opc.Ua.Bindings.TcpClientChannel.ParseResponse C# (CSharp) Method

ParseResponse() private method

Parses the response return from the server.
private ParseResponse ( BufferCollection chunksToProcess ) : IServiceResponse
chunksToProcess BufferCollection
return IServiceResponse
        private IServiceResponse ParseResponse(BufferCollection chunksToProcess)
        {
            BinaryDecoder decoder = new BinaryDecoder(new ArraySegmentStream(chunksToProcess), Quotas.MessageContext);

            try
            {       
                IServiceResponse response = BinaryDecoder.DecodeMessage(new ArraySegmentStream(chunksToProcess), null, Quotas.MessageContext) as IServiceResponse;

                if (response == null)
                {
                    throw ServiceResultException.Create(StatusCodes.BadStructureMissing, "Could not parse response body.");
                }

                return response;
            }
            finally
            {
                decoder.Close();
            }
        }