Пример #1
0
        private void SendEchoFrame(byte[] nonce)
        {
            ServerEchoFrame frame = new ServerEchoFrame();

            frame.Nonce = nonce;

            SendFrame(frame);
        }
Пример #2
0
        private void HandleEchoFrame(ServerEchoFrame frame)
        {
            if (_validateEcho)
            {
                if (!CompareBytes(frame.Nonce, 0, ServerNonce, 0, ServerNonce.Length))
                {
                    OnExceptionThrown(new InvalidDataException("Nonce echo failed."));
                    return;
                }

                Establish();
            }
            else
            {
                _validateEcho = true;

                ClientNonce = frame.Nonce;
                ServerNonce = CreateNonce(NONCE_LENGTH);

                BufferFrame(new ServerEchoFrame(), FrameState.ServerEcho);
                SendEchoFrame();
            }
        }