public async Task SendMessage(string hostName, LIFXProtocolPacket packet)
        {
            if (hostName == null)
            {
                hostName = "255.255.255.255";
            }

            var bytes = packet.GetBytes();
            await _socket.SendAsync(bytes, bytes.Length, hostName, PORT);
        }
        private LIFXProtocolPacket ParseBytesToLIFXProtocolPacket(byte[] data)
        {
            using (MemoryStream ms = new MemoryStream(data))
            {
                var packet = new LIFXProtocolPacket();

                BinaryReader br = new BinaryReader(ms);
                //frame
                var size = br.ReadUInt16();
                if (data.Length != size || size < 36)
                {
                    throw new Exception("Invalid packet");
                }

                // Frame
                packet.Frame      = new LIFXProtocolFrame();
                packet.Frame.Size = size;
                // Orgin
                var partialFramData = br.ReadUInt16();
                // TODO: Get tagged out of data
                packet.Frame.Tagged = false;
                packet.Frame.Source = br.ReadUInt32();

                // Frame Address
                packet.FrameAddress        = new LIFXProtocolFrameAddress();
                packet.FrameAddress.Target = br.ReadBytes(8);

                ms.Seek(6, SeekOrigin.Current); //skip reserved

                var partialFrameAddressData = br.ReadByte();
                // TODO: Get 2 bits out out of data
                packet.FrameAddress.AckRequired = false;
                packet.FrameAddress.ResRequired = false;
                packet.FrameAddress.Sequence    = br.ReadByte();

                // Protocol Header
                packet.ProtocolHeader = new LIFXProtocolProtocolHeader();

                br.ReadUInt64();

                packet.ProtocolHeader.Type = br.ReadUInt16();

                ms.Seek(2, SeekOrigin.Current); //skip reserved

                if (size > 36)
                {
                    packet.Payload = br.ReadBytes(size - 36);
                }

                return(packet);
            }
        }