title: How to quickly ping all ip addresses in a network?
body: <p>So I am making a network scanner in c# to show all connected devices to the same network as you. The way I am doing this is by doing a ping command on all IP's from 192.168.0.1 to 192.168.0.255.</p>
  
  <pre><code>private void IPlook_Tick(object sender, EventArgs e)
      {
  
          Properties.Settings.Default.nextIP += 1;
  
          if (Properties.Settings.Default.nextIP &gt;= 255)
          {
              IPlook.Stop();
          }
  
          string IP = "192.168.0." + Properties.Settings.Default.nextIP.ToString();
          CurIP.Text = IP;
  
          //See if online
          try
          {
              Ping ping = new Ping();
              PingReply pingreply = ping.Send(IP);
  
              if (pingreply.Status == IPStatus.Success)
              {
                  string Hostname = Dns.GetHostByAddress(IP).HostName;
                  dataGridView1.Rows.Add(Hostname, IP, "");
              }
              else
              {
              }
  
          }
          catch (Exception er)
          {
              MessageBox.Show("Something Went Wrong", "Error Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
          }
  
      }
  </code></pre>
  
  <p>This is working fine but the problem is it is taking a <strong>very</strong> long time and making the program laggy. I have set the interval on the timer to 50.</p>
  
  <p>Any help is appreciated.</p>
  
  <p>Legitimate</p>