.NET Tip: Creating a Simple Monitor with Ping Nashville TN

By using the Ping class, one of the many classes included in the .NET Framework Library, you can create a simple server monitor that ensures your servers are all responding to network traffic.

Local Companies

Crosslin & Associates PC
615-320-5500
2525 W End Ave
Nashville, TN
Advanced Network Solutions
615-277-0500
105 Broadway
Nashville, TN
Peachtree Software Support
615-256-1111
415 4th Ave S
Nashville, TN
Advanced Technical Services
615-747-5810
200 Hill Ave
Nashville, TN
Computer Services
615-252-8044
230 Willow St
Nashville, TN
Affiliated Computer Services
615-874-3000
801 Royal Pkwy
Nashville, TN
Computer Repair
615-882-9446
2744 Old Lebanon RD
Nashville, TN
Cumberland Technical Services
615-297-6815
420 Elmington Ave
Nashville, TN
Cyberangel Security Solutions Inc
615-837-9191
475 Metroplex DR
Nashville, TN
Cbnc LLC
615-831-3270
5360 Edmondson Pike
Nashville, TN

provided by: 
Originally published at Internet.com


The .NET Framework Library includes a vast number of classes and functions, some of which you'd never know about. Take the Ping class, for example. Although actually an acronym for Packet INternet Groper, Ping really refers to submarines that send sonar "pings" to find other objects underwater. When diagnosing network issues, the first thing I do is ping the name or IP address to make sure it's accessible. If I don't get a good result, I have use other tools to do further diagnosis. This tip teaches you how to use the Ping class to test network connectivity.

For a web-hosting company, it's embarrassing when a client tells you a server is down before you realize it yourself. By using the Ping class, you can create a simple server monitor to make sure your servers are all responding to network traffic. The following code loops through a list of server addresses to make sure that each server is responding: ArrayList addrs = new ArrayList(); addrs.Add("www.intel.com"); addrs.Add("www.developer.com"); addrs.Add("www.codeguru.com"); addrs.Add("www.northcomp.com"); addrs.Add("www.techniquescentral.com"); Ping p = new Ping(); PingReply r; foreach (string s in addrs) { r = p.Send(s); if (r.Status == IPStatus.Success) { Console.WriteLine("Ping to {0} [{1}] successful - {2} bytes in {3} ms.", s, r.Address.ToString(), r.Buffer.Length, r.RoundtripTime); } else Console.WriteLine("Ping to {0} failed.", s); } Console.WriteLine("Ping check completed.");

You'll need to add the System.Net.NetworkInformation library to your list of using statements for this code to work properly. The results will vary based on your network speed, but in my own testing, pings to developer.com and codeguru.com timed out. Does this mean the Web sites are not up? No. More than likely, the firewalls protecting those sites are blocking ping traffic because pings can be used to perform denial-of-service attacks. However, if your firewall does allow ping traffic to go through, this can be a simple way to test network connectivity.

About the Author

Eric Smith is the owner of Northstar Computer Systems, a Web-hosting company based in Indianapolis, Indiana. He is also an MCT and MCSD who has been developing with .NET since 2001. In addition, he has written or contributed to 12 books covering .NET, ASP, and Visual Basic. Send him your questions and feedback via e-mail at questions@techniquescentral.com.

Author: Eric Smith

Read article at Internet.com site

Featured Local Company

Crosslin & Associates PC

615-320-5500
2525 W End Ave
Nashville, TN

Related Local Events
Christians In Action Trade Show
Dates: 10/16/2009 - 10/17/2009
Location: Gaylord Opryland Resort & Convention Center
Nashville, TN
View Details

MS PowerPoint 2002 (XP) Level Two
Dates: 7/16/2009 - 7/16/2009
Location: Greater Nashville Association of Realtors
Nashville, TN
View Details

Intergraph 2009
Dates: 6/15/2009 - 6/18/2009
Location: Gaylord Opryland Resort & Convention Center
Nashville, TN
View Details