Esempio n. 1
0
        protected void handleRemoteCommand(NetworkStream stream, QueuedCommand serverCommand)
        {
            var emc = encryptMessage(serverCommand);
            emc.WriteToStream(stream);

            string response;

            using (MemoryStream ms = new MemoryStream())
            {
                stream.CopyTo(ms);
                ms.Position = 0;
                var emr = EncryptedMessage.FromStream(ms);
                response = decryptMessage(emr);
            }

            serverCommand.ResultSource.SetResult(response);
            stream.Close();
        }