Exemplo n.º 1
0
        public Device(Socket so)
        {
            this.Socket = so;

            if (Constants.RC4)
            {
                IncomingPacketsKey = new byte[Key._RC4_EndecryptKey.Length];
                Array.Copy(Key._RC4_EndecryptKey, IncomingPacketsKey, Key._RC4_EndecryptKey.Length);

                OutgoingPacketsKey = new byte[Key._RC4_EndecryptKey.Length];
                Array.Copy(Key._RC4_EndecryptKey, OutgoingPacketsKey, Key._RC4_EndecryptKey.Length);
            }
            else
            {
                this.Keys = new Crypto();
            }

            this.SocketHandle = so.Handle;

            this.IPAddress = ((IPEndPoint)so.RemoteEndPoint).Address.ToString();

            this.Keep_Alive    = new Keep_Alive_OK(this);
            this.LastKeepAlive = DateTime.Now;
            this.NextKeepAlive = this.LastKeepAlive.AddSeconds(30);
            this.Stream        = new List <byte>(Constants.Buffer);
        }
Exemplo n.º 2
0
        public Device(Socket socket)
        {
            this.Socket       = socket;
            this.SocketHandle = socket.Handle;
            this.Stream       = new List <byte>(Constants.Buffer);
            this.Keep_Alive   = new Keep_Alive_OK(this);

            this.IncomingPacketsKey = new byte[Key._RC4_EndecryptKey.Length];
            Array.Copy(Key._RC4_EndecryptKey, this.IncomingPacketsKey, Key._RC4_EndecryptKey.Length);

            this.OutgoingPacketsKey = new byte[Key._RC4_EndecryptKey.Length];
            Array.Copy(Key._RC4_EndecryptKey, this.OutgoingPacketsKey, Key._RC4_EndecryptKey.Length);

            this.LastKeepAlive = DateTime.Now;
            this.NextKeepAlive = this.LastKeepAlive.AddSeconds(30);
        }