Esempio n. 1
0
        /// <summary>
        /// Initial handshake with the server
        /// </summary>
        public void HandShake()
        {
            Medium.WriteByte(CommandType);
            byte errCode = Medium.ReadByte();

            if (errCode != 0)
            {
                ErrorCode ec = new ErrorCode(errCode);
                throw new CommunicationException(ec.ToString());
            }
        }
Esempio n. 2
0
        protected override string ExecuteInternal()
        {
            HandShake();

            uint val  = Medium.ReadUInt32();
            uint calc = ReverseFunction(val);

            Medium.WriteUInt32(calc);

            byte result = Medium.ReadByte();

            string ret = "Received: 0x" + val.ToString("X")
                         + " Sent: 0x" + calc.ToString("X")
                         + " Result: 0x" + result.ToString("X");

            return(ret);
        }