예제 #1
0
파일: Connect.cs 프로젝트: 4058665/MQTT
        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;
        }
예제 #2
0
파일: Connect.cs 프로젝트: 4058665/MQTT
        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;
        }