Exemplo n.º 1
0
        public QueueClient(QueueManager manager, LengthedSocket socket)
        {
            Manager           = manager;
            Socket            = socket;
            Socket.OnReceive += OnReceive;
            Socket.OnError   += OnError;

            Socket.ReceiveAsync();

            Socket.Send(new ServerKeyPacket
            {
                PublicKey = Manager.Config.PublicKey,
                Prime     = Manager.Config.Prime,
                Generator = Manager.Config.Generator
            });

            State = QueueState.Authenticating;
        }
Exemplo n.º 2
0
        public LoginClient(LoginManager manager, LengthedSocket socket)
        {
            Manager = manager;

            Socket             = socket;
            Socket.AutoReceive = false;
            Socket.OnReceive  += OnReceive;
            Socket.OnError    += OnError;

            DHKeyExchange.GeneratePrivateAndPublicA(PrivateKey, PublicKey);

            Socket.Send(new ServerKeyPacket
            {
                PublicKey = PublicKey,
                Prime     = DHKeyExchange.ConstantPrime,
                Generator = DHKeyExchange.ConstantGenerator
            });

            Socket.OnEncrypt += OnEncrypt;
            Socket.ReceiveAsync();
        }