Esempio n. 1
0
        public async Task SendCommand(SmartBrickMessage message)
        {
            //serialize
            byte[] data = message.SerializeData();

            //encrypt

            //pack
            var sockMsg = new List <byte>();

            sockMsg.AddRange(message.PipeAddress);

            sockMsg.AddRange(data);

            try
            {
                _sending = true;
                //send
                await _socket.SendTask(sockMsg.ToArray(), 0, sockMsg.Count, SocketFlags.None);

                _sending = false;
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
            }
            finally
            {
                _sending = false;
            }
        }