Sunday, December 18, 2011

C# Ping an IP Address

1:  Ping ps = new Ping();  
2:  IPAddress address = IPAddress.Parse("173.201.96.128");  
3:  PingReply reply = ps.Send(address);  
4:  if (reply.Status == IPStatus.Success)  
5:  {  
6:    MessageBox.Show("Online");  
7:  }  
8:  else  
9:  {  
10:    MessageBox.Show(reply.Status.ToString());  
11:  }  

No comments:

Post a Comment