title: how to handle the ping exception in C#?
body: <p>I am getting the error <code>System.Net.NetworkInformation.PingException</code> for the following code.</p>
  
  <pre><code>Ping ping = new Ping();
  PingReply stats = ping.Send(IPAddress.Parse("8.8.4.4"));
  if (stats.Status == IPStatus.Success)
  {
      if(net)
          textBox1.Text = "connected"; 
      else 
          textBox1.Text="Not connected";
  }
  </code></pre>
  
  <p>Can anybody tell whats wrong here?</p>
  
  <p>NOTE : the error occurs on line 2</p>