ping webclient
1 Ping pingSender = new Ping();
2 try
3 {
4 PingReply reply = pingSender.Send(this.txtIp.Text.ToString());
5 if (reply.Status == IPStatus.Success)
6 {
7 MessageBox.Show("OK");
8 }
9 else
10 {
11 MessageBox.Show("fail");
12 }
13 }
14 catch (System.Exception ex)
15 {
16 MessageBox.Show(ex.Message);
17 return;
18 }
19 }
20
21 、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
22 try
23 {
24 WebClient webClient = new WebClient();
25 webClient.DownloadFile("http://images.com/123.jpg", "123.jpg");
26 this.picShow.Image = Image.FromFile("123.jpg");
27 }
28 catch (Exception ex)
29 {
30 MessageBox.Show(ex.Message);
31 }
2 try
3 {
4 PingReply reply = pingSender.Send(this.txtIp.Text.ToString());
5 if (reply.Status == IPStatus.Success)
6 {
7 MessageBox.Show("OK");
8 }
9 else
10 {
11 MessageBox.Show("fail");
12 }
13 }
14 catch (System.Exception ex)
15 {
16 MessageBox.Show(ex.Message);
17 return;
18 }
19 }
20
21 、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
22 try
23 {
24 WebClient webClient = new WebClient();
25 webClient.DownloadFile("http://images.com/123.jpg", "123.jpg");
26 this.picShow.Image = Image.FromFile("123.jpg");
27 }
28 catch (Exception ex)
29 {
30 MessageBox.Show(ex.Message);
31 }