using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading; using System.Net.NetworkInformation; namespace ping_test_2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Ping p = new Ping(); PingReply r; string s; s = textBox1.Text; r = p.Send(s); if (r.Status == IPStatus.Success) { listBox1.Items.Add( "Ping to " + s.ToString() + r.Address.ToString() + "]" + " Successful" + " Response delay = " + r.RoundtripTime.ToString() + " ms" + "\n"); button2.BackColor = Color.Green; } else if (r.Status == IPStatus.TimedOut) { button2.BackColor = Color.Red; } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)