Exemple #1
0
        protected string ReadStringFromStream(MessageStream input)
        {
            ushort len = ReadUshortFromStream(input);

            byte[]       data = input.readBytes(len);
            UTF8Encoding enc  = new UTF8Encoding();

            return(enc.GetString(data, 0, data.Length));
        }
        protected override void readMessage(MessageStream input, int msgLength)
        {
            int pos = 0;

            topic = ReadStringFromStream(input);

            pos += FormatUtil.toMQttString(topic).Length;
            if (getQos() != QoS.AT_MOST_ONCE)
            {
                base.readMessage(input, msgLength);
                pos += 2;
            }
            int payloadSize = (msgLength - pos);

            data = input.readBytes(payloadSize);
        }