/// <summary>
 /// Create new thread manager.
 /// </summary>
 /// <param name="action">FlooderAction object to use as parameters for the sender / receiver</param>
 public FlooderThread(FlooderAction action)
 {
     Action     = action;
     UDPSocket  = null;
     HeaderLen  = 0;
     SW         = new Stopwatch();
     recvBuffer = new byte[65535];
     SenderTask = new BackgroundWorker();
     SenderTask.WorkerSupportsCancellation = true;
     SenderTask.WorkerReportsProgress      = true;
     SenderTask.DoWork          += SenderTask_DoWork;
     SenderTask.ProgressChanged += SenderTask_ProgressChanged;
 }
Esempio n. 2
0
 public Flooder()
 {
     Action                 = new FlooderAction();
     IsRunning              = false;
     ft                     = new FlooderThread[Action.Concurrency];
     UpdateReceived         = new bool[Action.Concurrency];
     LatestResult           = new FlooderResult();
     History                = new FlooderResult[5000 / Action.TimeQuantum];
     HistoryCounter         = 0;
     UIUpdateTimer          = new System.Timers.Timer(Action.TimeQuantum);
     UIUpdateTimer.Elapsed += UIUpdateTimer_Elapsed;
     for (int i = 0; i < Action.Concurrency; i++)
     {
         ft[i] = new FlooderThread(Action);
         ft[i].PropertyChanged += FlooderThread_PropertyChanged;
     }
 }