.NET Tip: Creating a Simple Monitor with Ping Wisconsin

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

Wireless Direct
1.866.707.8498
BOX 71101
shorewood, WI
R.E. Coker and Associates, Inc.
262-723-8104
108 W Court St.
Elkhorn, WI
R S InfoCon, Inc.
262-898-7456
2320 Renaissance Blvd
Sturtevant, WI
Xorbix Technologies Inc.
414-277-5044
759 N. Milwaukee St.
Milwaukee, WI
HarrisData
262-784-9099
13555 Bishop's Court, Suite 300
Brookfield, WI
IFS
414-577-5191
12000 W. Park Place
Milwaukee, WI
Visionary Computer Solutions
262-365-9430
PO Box 406
Grafton, WI
Acumium
608 310 9700 x 522
5133 West Terrace Drive Suite 300
Madison, , WI
Statpac Inc
(715) 442-2261
1200 1st St
Pepin, WI
Larson Consulting
(920) 346-5876
127 E Main St
Brandon, 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

R.E. Coker and Associates, Inc.

262-723-8104
108 W Court St.
Elkhorn, WI
http://www.recoker.com

Regional Articles
- .NET Tip: Creating a Simple Monitor with Ping Appleton WI
- .NET Tip: Creating a Simple Monitor with Ping Baraboo WI
- .NET Tip: Creating a Simple Monitor with Ping Beaver Dam WI
- .NET Tip: Creating a Simple Monitor with Ping Beloit WI
- .NET Tip: Creating a Simple Monitor with Ping Brookfield WI
- .NET Tip: Creating a Simple Monitor with Ping Burlington WI
- .NET Tip: Creating a Simple Monitor with Ping Cedarburg WI
- .NET Tip: Creating a Simple Monitor with Ping Chippewa Falls WI
- .NET Tip: Creating a Simple Monitor with Ping Cudahy WI
- .NET Tip: Creating a Simple Monitor with Ping De Pere WI
- .NET Tip: Creating a Simple Monitor with Ping Delavan WI
- .NET Tip: Creating a Simple Monitor with Ping Eau Claire WI
- .NET Tip: Creating a Simple Monitor with Ping Elkhorn WI
- .NET Tip: Creating a Simple Monitor with Ping Fond Du Lac WI
- .NET Tip: Creating a Simple Monitor with Ping Fort Atkinson WI
- .NET Tip: Creating a Simple Monitor with Ping Franklin WI
- .NET Tip: Creating a Simple Monitor with Ping Green Bay WI
- .NET Tip: Creating a Simple Monitor with Ping Hartland WI
- .NET Tip: Creating a Simple Monitor with Ping Janesville WI
- .NET Tip: Creating a Simple Monitor with Ping Kaukauna WI
- .NET Tip: Creating a Simple Monitor with Ping Kenosha WI
- .NET Tip: Creating a Simple Monitor with Ping La Crosse WI
- .NET Tip: Creating a Simple Monitor with Ping Lake Geneva WI
- .NET Tip: Creating a Simple Monitor with Ping Manitowoc WI
- .NET Tip: Creating a Simple Monitor with Ping Marinette WI
- .NET Tip: Creating a Simple Monitor with Ping Marshfield WI
- .NET Tip: Creating a Simple Monitor with Ping Menasha WI
- .NET Tip: Creating a Simple Monitor with Ping Menomonee Falls WI
- .NET Tip: Creating a Simple Monitor with Ping Menomonie WI
- .NET Tip: Creating a Simple Monitor with Ping Merrill WI
- .NET Tip: Creating a Simple Monitor with Ping Middleton WI
- .NET Tip: Creating a Simple Monitor with Ping Milwaukee WI
- .NET Tip: Creating a Simple Monitor with Ping Mosinee WI
- .NET Tip: Creating a Simple Monitor with Ping Mukwonago WI
- .NET Tip: Creating a Simple Monitor with Ping Muskego WI
- .NET Tip: Creating a Simple Monitor with Ping Neenah WI
- .NET Tip: Creating a Simple Monitor with Ping New Berlin WI
- .NET Tip: Creating a Simple Monitor with Ping Oak Creek WI
- .NET Tip: Creating a Simple Monitor with Ping Oconomowoc WI
- .NET Tip: Creating a Simple Monitor with Ping Onalaska WI
- .NET Tip: Creating a Simple Monitor with Ping Oshkosh WI
- .NET Tip: Creating a Simple Monitor with Ping Pewaukee WI
- .NET Tip: Creating a Simple Monitor with Ping Racine WI
- .NET Tip: Creating a Simple Monitor with Ping Rhinelander WI
- .NET Tip: Creating a Simple Monitor with Ping Rice Lake WI
- .NET Tip: Creating a Simple Monitor with Ping River Falls WI
- .NET Tip: Creating a Simple Monitor with Ping Schofield WI
- .NET Tip: Creating a Simple Monitor with Ping Shawano WI
- .NET Tip: Creating a Simple Monitor with Ping Sheboygan WI
- .NET Tip: Creating a Simple Monitor with Ping South Milwaukee WI
- .NET Tip: Creating a Simple Monitor with Ping Stevens Point WI
- .NET Tip: Creating a Simple Monitor with Ping Sturgeon Bay WI
- .NET Tip: Creating a Simple Monitor with Ping Sun Prairie WI
- .NET Tip: Creating a Simple Monitor with Ping Superior WI
- .NET Tip: Creating a Simple Monitor with Ping Thiensville WI
- .NET Tip: Creating a Simple Monitor with Ping Two Rivers WI
- .NET Tip: Creating a Simple Monitor with Ping Watertown WI
- .NET Tip: Creating a Simple Monitor with Ping Waukesha WI
- .NET Tip: Creating a Simple Monitor with Ping Waupaca WI
- .NET Tip: Creating a Simple Monitor with Ping Wausau WI
- .NET Tip: Creating a Simple Monitor with Ping West Bend WI
- .NET Tip: Creating a Simple Monitor with Ping Whitewater WI
- .NET Tip: Creating a Simple Monitor with Ping Wisconsin Rapids WI
Related Local Events
2008 Early Stage Symposium
Dates: 11/5/2008 - 11/6/2008
Location: Monona Terrace
Madison WI
View Details

Wisconsin Entrepreneurs' Conference
Dates: 6/9/2008 - 6/10/2008
Location: Hyatt Regency Hotel
Milwaukee WI
View Details
Rate Article
     
Articles Insider

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

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