Esempio n. 1
0
        internal static V3ConnectVariableHeader FromStream(Stream stream)
        {
            var header = new V3ConnectVariableHeader
                {
                    ProtocolName = MQString.FromStream(stream),
                    Protocolversion = stream.ReadByteOrFail(),
                    ConnectFlags = ConnectFlags.FromStream(stream),
                    KeepAliveTimer = stream.ReadUint16()
                };

            return header;
        }
Esempio n. 2
0
        internal static ConnectFlags FromStream(Stream stream)
        {
            byte b = stream.ReadByteOrFail();
            var flags = new ConnectFlags
                {
                    UserName = (b & 0x80) == 0x80,
                    Password = (b & 0x40) == 0x40,
                    WillRetain = (b & 0x20) == 0x20,
                    WillQoS = (QualityOfService) ((b & 0x18) >> 3),
                    Will = (b & 0x04) == 0x04,
                    CleanSession = (b & 0x02) == 0x02
                };

            return flags;
        }