コード例 #1
0
    protected NetCore()
    {
        seqId     = 0;
        encryptor = null;
        decryptor = null;

        Byte[] _p = BitConverter.GetBytes(NetProto.Config.DH1PRIME);
        if (BitConverter.IsLittleEndian)
        {
            Array.Reverse(_p);
        }

        Byte[] _g = BitConverter.GetBytes(NetProto.Config.DH1BASE);
        if (BitConverter.IsLittleEndian)
        {
            Array.Reverse(_g);
        }

        dhEnc = new DiffieHellmanManaged(_p, _g, 31);
        dhDec = new DiffieHellmanManaged(_p, _g, 31);

        msgQueue   = new Queue();
        Handle     = new NetProto.NetHandle();
        dispatcher = new NetProto.Dispatcher();
        // 注册回调
        dispatcher.Register(Handle);
    }
コード例 #2
0
    protected NetCore()
    {
        seqid     = 0;
        encryptor = null;
        decryptor = null;

        connectDone = new ManualResetEvent(false);
        receiveDone = new ManualResetEvent(false);

        Byte[] _p = BitConverter.GetBytes(NetProto.Config.DH1PRIME);
        if (BitConverter.IsLittleEndian)
        {
            Array.Reverse(_p);
        }

        Byte[] _g = BitConverter.GetBytes(NetProto.Config.DH1BASE);
        if (BitConverter.IsLittleEndian)
        {
            Array.Reverse(_g);
        }

        enc_dh = new DiffieHellmanManaged(_p, _g, 31);
        dec_dh = new DiffieHellmanManaged(_p, _g, 31);

        msg_queue  = new Queue();
        Handle     = new NetProto.NetHandle();
        dispatcher = new NetProto.Dispatcher();
    }