.NET Tip: Creating a Simple Monitor with Ping Oshkosh WI

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

Infinity Technology
(920) 430-7020
1901 S Webster Ave
Green Bay, WI
Logicare
(715) 839-0700
2125 Heights Dr Ste 4
Eau Claire, WI
Spectrum Data Resources
(920) 722-1949
2414 Industrial Dr
Neenah, WI
Link Development Corp
(262) 641-9911
12660 W North Ave
Brookfield, WI
Montgomery & Associates Inc
(414) 425-5184
6965 W Wildwood Creek Ct
Franklin, WI
Journal Sentinel Online
(920) 429-9309
1265 Lombardi Ave
Green Bay, WI
Greenbrier & Russel
(920) 225-6800
1019 Truman St
Kimberly, WI
University of Wisconsin- Superior
(715) 394-8470
Superior, WI
Statpac Inc
(715) 442-2261
1200 1st St
Pepin, WI
Datamatic Processing Inc of Wis
(920) 734-2647
1000 N Lynndale Dr
Appleton, WI

.NET Tip: Creating a Simple Monitor with Ping

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

Visionary Computer Solutions

262-365-9430
PO Box 406
Grafton, WI
http://www.visionarycomputersolutions.com

Visionary Computer Solutions specializes in providing computer solutions of all sizes for all businesses, including:

-Custom software development

-Maintenance and enhancement of existing software

-Web development

-PC hardware upgrades

Your business is extremely important to you. And your business success is extremely important to us. We work closely with our clients to determine their needs and provide advanced solutions on-time and within their budget.

Headquartered in Grafton, Wisconsin, we work with businesses throughout the United States.


Rate Article
     
Articles Insider

Rss   Delicious   Digg   Add To My Yahoo   Add To My Google   Bookmark   Search Plugin

Topics:
Advertising Engineering Home Services Retail & Consumer Services
Business Services Entertainment Industrial Goods & Services Software
Career Family Insurance Technology
Cars Financial Services Internet Telecommunications
Computer Hardware Food & Beverage Legal Transportation & Logistics
Construction Health Pets Travel
Education Home Electronics Real Estate Wedding