Beispiel #1
0
    public void WorkerMain(string sWebUrl, int iCreateNum, string sVersion, double fTickCnt, TextBox t)
    {
        m_Textbox = t;
        m_bStop   = false;
        string sAccount = "Tester_" + iCreateNum;

        fTickCnt *= 1000.0f;
        int iCurrent  = 0;
        int iLastTick = 0;

        AddLog(sAccount + " is starting");

        PacketTester tester = new PacketTester(this, sWebUrl, sAccount, sVersion, fTickCnt);

        tester.SetUID((UInt64)iCreateNum);
        tester.Login("localhost", 9001);

        while (!m_bStop)
        {
            iCurrent = Environment.TickCount;
            if (iCurrent - iLastTick >= fTickCnt)
            {
                iLastTick = iCurrent;
                if (tester.IsConnected())
                {
                    if (!tester.SendTestPacket())
                    {
                        m_bStop = true;
                        break;
                    }
                }
            }
            else
            {
                Thread.Sleep(1);
            }
        }

        tester.Logout();
        AddLog(sAccount + " is stopped");
        tester = null;
    }
Beispiel #2
0
 public NetManager(PacketTester t)
 {
     m_Sockets = new Hashtable();
     tester    = t;
 }