Exemple #1
0
        static void Main(string[] args)
        {
            NccpcNw1Cmn.stWsaStartup();

            string
                mnhost = Mgrc1Test2Gwsv.Properties.Settings.Default.MnsvHost, mnserv = Mgrc1Test2Gwsv.Properties.Settings.Default.MnsvServ,
                gwhost = Mgrc1Test2Gwsv.Properties.Settings.Default.GwsvHost, gwserv = Mgrc1Test2Gwsv.Properties.Settings.Default.GwsvServ;

            int buffersize = 0xffff,
                svomax = 50, uromax = Mgrc1Test2Gwsv.Properties.Settings.Default.UroMax;

            var mm = new NccpcMemmgr2Mgr();
            var tm = new NccpcTdMgr2();
            var gw = new TtGw();

            if (!mm.create())
            {
                qv("mm create fail"); return;
            }
            if (!tm.create())
            {
                qv("tm create fail"); return;
            }

            qv("Dbg Gwsv startup mnh:" + mnhost + " mns:" + mnserv + "gwh:" + gwhost + " gws:" + gwserv + " UroMax:" + uromax);
            qv("Dbg key: Q = Quit, ");

            if (!gw.create(mnhost, mnserv, gwhost, gwserv, uromax))
            {
                qv("Dbg Gw create fail gwserv:" + gwserv); return;
            }
            qv("Dbg gw created");

            gw.setGwctAliveTimeout(10);


            bool bWhile = true;

            while (bWhile)
            {
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo k = Console.ReadKey(false);

                    switch (k.Key)
                    {
                    case ConsoleKey.Q:
                        bWhile = false;
                        qv("Dbg quit");
                        break;

                    case ConsoleKey.M:
                    {
                    }
                    break;
                    }
                }
                else
                {
                    System.Threading.Thread.Sleep(100);
                }

                gw.framemove(100);
            }


            tm.iocptdWorkerClose();

            gw.release();
            tm.release();
            mm.release();

            NccpcNw1Cmn.stWsaCleanup();
            gFlog.onAppdestory();
        }
        static void Main(string[] args)
        {
            qv("Dbg " + (new System.Diagnostics.StackFrame(0, true)).GetFileName());
            NccpcNw1Cmn.stWsaStartup();

            var mm = new NccpcMemmgr2Mgr();
            //var tm = new NccpcTdMgr2();
            var  cts  = new List <TtCt>();
            var  sv   = new TtSv(mm);
            long ctcc = 0;             //conn cnt;

            if (!mm.create())
            {
                qv("Err mm create fail"); return;
            }
            //if (!tm.create()) { qv("Err tm create fail"); return; }
            //if (!sv.create()) { qv("Err sv create fail"); return; }


            qv("Dbg Ctm1 startup h:" + gHost + " s:" + gServ);
            qv("Dbg key: Q = Quit, ");


            bool bWhile = true;

            while (bWhile)
            {
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo k = Console.ReadKey(false);

                    switch (k.Key)
                    {
                    case ConsoleKey.Q:
                        bWhile = false;
                        qv("Dbg quit");
                        break;

                    case ConsoleKey.S:
                    {
                        if (!sv.create())
                        {
                            qv("Err sv.create fail"); break;
                        }
                    }
                    break;

                    case ConsoleKey.C:
                    {
                        for (int tc = 0; tc < gCtmax; tc++)
                        {
                            var ct = new TtCt(ref ctcc);
                            if (!ct.create())
                            {
                                qv("Err Ct.create() fail"); return;
                            }

                            using (var pkw = NccpcNw1Pk2.stAlloc(gPkBfMax))
                            {
                                var pkwlen = pkw.getWritableLen();
                                for (int i = 0; i < pkwlen; i++)
                                {
                                    pkw.wInt8s((sbyte)i);
                                }

                                ct.send(pkw);
                            }

                            cts.Add(ct);

                            //lock (gLockobj) { gTdCnt++; }

                            //Jc1.Tdut.exec(ct.exec);
                        }
                    }
                    break;

                    case ConsoleKey.L:
                    {
                        if (gFlog != null)
                        {
                            qv("Dbg Log off"); gFlog = null;
                        }
                        else
                        {
                            gFlog = new NccpcSflMt1Simple1("Nc1ExNwStress1", 0xffff); qv("Dbg Log on");
                        }
                    }
                    break;
                    }
                }
                else
                {
                    sv.framemove();
                    //if (cts.Count != 0) { qv("Dbg Cts:" + cts.Count + " Ctcc:" + System.Threading.Interlocked.Read(ref TtCt.gCtcc)); }
                    System.Threading.Thread.Sleep(1000);
                }
            }

            foreach (var ct in cts)
            {
                ct.release();
            }

            sv.release();

            mm.release();

            NccpcNw1Cmn.stWsaCleanup();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            qv("Dbg " + (new System.Diagnostics.StackFrame(0, true)).GetFileName());
            NccpcNw1Cmn.stWsaStartup();

            string
            //hostbegin = Nc1ExPortscanCspCon1.Properties.Settings.Default.HostBegin,
            //hostend = Nc1ExPortscanCspCon1.Properties.Settings.Default.HostEnd,
                serv    = Nc1ExIpscanCspCon1.Properties.Settings.Default.Serv;
            int findtdc = Nc1ExIpscanCspCon1.Properties.Settings.Default.FindThread;

            gHostBeginStr = Nc1ExIpscanCspCon1.Properties.Settings.Default.HostBegin;
            gHostEndStr   = Nc1ExIpscanCspCon1.Properties.Settings.Default.HostEnd;
            gServRst      = serv;

            gHostBeginInt = CnvIpv4ToInt64(gHostBeginStr);
            var t1 = CnvInt64ToIpv4(gHostBeginInt);

            gHostEndInt = CnvIpv4ToInt64(gHostEndStr);

            gHostCur = gHostBeginInt;

            //var mm = new NccpcMemmgr2Mgr();
            //var tm = new NccpcTdMgr2();
            //var ct1i = DateTime.Now.Ticks % uromax;
            var cts = new List <TtCt>();

            //if (!mm.create()) { qv("mm create fail"); return; }
            //if (!tm.create()) { qv("tm create fail"); return; }

            qv("Dbg Ctm1 startup h:" + gHostBeginStr + " s:" + serv);
            qv("Dbg key: Q = Quit, ");


            for (int tc = 0; tc < findtdc; tc++)
            {
                var ct = new TtCt();
                cts.Add(ct);

                lock (gLockobj) { gTdCnt++; }

                Jc1.Tdut.exec(ct.find1);
            }


            qv("Dbg ct created");


            bool bWhile = true;

            while (bWhile)
            {
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo k = Console.ReadKey(false);

                    switch (k.Key)
                    {
                    case ConsoleKey.Q:
                        bWhile = false;
                        qv("Dbg quit");
                        break;

                    case ConsoleKey.M:
                    {
                    }
                    break;
                    }
                }
                else
                {
                    System.Threading.Thread.Sleep(100);
                }

                //ct1.framemove(100);

                lock (gLockobj)
                {
                    if (gTdCnt == 0)
                    {
                        qv("");
                        qv("***** WorkEnd ***** ");
                        if (gHostRst != null && gServRst != null)
                        {
                            qv("Dbg host:" + gHostRst + " serv:" + gServRst);
                        }
                        else
                        {
                            qv("Dbg fail");
                        }
                        qv("");

                        bWhile = false;
                    }
                }
            }

            foreach (var ct in cts)
            {
                ct.release();
            }

            NccpcNw1Cmn.stWsaCleanup();
        }
        static void Main(string[] args)
        {
            NccpcNw1Cmn.stWsaStartup();

            string
                gwhost = Mgrc1Test2Ctm1.Properties.Settings.Default.GwsvHost, gwserv = Mgrc1Test2Ctm1.Properties.Settings.Default.GwsvServ;

            const int buffersize = 0xffff,
                      svomax = 50, uromax = 500;

            var mm  = new NccpcMemmgr2Mgr();
            var tm  = new NccpcTdMgr2();
            var ct1i = DateTime.Now.Ticks % uromax;
            var ct1 = new TtCt(mm, tm);

            if (!mm.create())
            {
                qv("mm create fail"); return;
            }
            if (!tm.create())
            {
                qv("tm create fail"); return;
            }

            qv("Dbg Ctm1 startup gwh:" + gwhost + " gws:" + gwserv);
            qv("Dbg key: Q = Quit, ");


            qv("Dbg ct:" + ct1i + " ptr:" + ct1 + " add gwhost:" + gwhost + " gwserv:" + gwserv);

            if (!ct1.create(gwhost, gwserv.ToString()))
            {
                qv("Dbg ct create fail"); return;
            }
            qv("Dbg ct created");

            ct1.urdLoginReqSend(ct1i);


            bool bWhile = true;

            while (bWhile)
            {
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo k = Console.ReadKey(false);

                    switch (k.Key)
                    {
                    case ConsoleKey.Q:
                        bWhile = false;
                        qv("Dbg quit");
                        break;

                    case ConsoleKey.M:
                    {
                    }
                    break;
                    }
                }
                else
                {
                    System.Threading.Thread.Sleep(100);
                }

                //ct1.framemove(100);
            }


            ct1.release();
            tm.release();
            mm.release();

            NccpcNw1Cmn.stWsaCleanup();
        }