Click here to Skip to main content
15,891,938 members
Articles / Programming Languages / C#
Article

Simple ICMP Service Monitor

Rate me:
Please Sign up or sign in to vote.
3.69/5 (9 votes)
6 Jul 20053 min read 76.4K   2.1K   50   18
An example of a moderately useful network utility.

Screen shot

Introduction

This simple lightweight application provides a solution for monitoring access to potentially critical network services.

Background

Working as a Network Administrator in an environment where the number of servers managed is continually growing, I had been looking for a simple utility like this one. I began the project in February and during my research came across FreePing available here. I reworked the UI and put together the source to "clone" it since I had already put in a great deal of effort at that point, and I was still interested in actually seeing how to write the code. FreePing is a nice utility and is available from tools4ever as a free download.

The ICMP class used in this demonstration was graciously provided as open source here. The timer was adapted from Mike Gold's EGG Timer demo which is available here.

How it Works

Once the Start button is pressed, the program reads the ini file and issues a ping for all of the hosts listed in the file. A separate thread is created for each host and it is passed the list view row as a parameter to allow it to control the information for that host's row. Threads are used to keep the user interface from waiting until the scan is completed to regain control.

At the completion of the scan initiation, a new thread is created which calls the Elapsed Time timer. This routine provides the information for the countdown clock located in the upper right portion of the main form. When the timer reaches 0, it is stopped and a call to the Monitors initialization routine is placed. The same routine is accessed by the Start button. This creates the Elapsed time loop needed to repeat the scans on regular intervals.

Points of Interest

This program was a learning experience and is the first application development I have undertaken. (I keep my rookie status.) This program demonstrates techniques for updating listview information, simple ini file creation without using interop services, a demonstration of how to load a CHM help file, and techniques for creating new execution threads.

It was for me a great learning project, which produced an application that I wanted, hopefully it will provide some useful purpose for others as well. The code is documented and should be easy to read but, I'll let you judge.

There is room for improvement, of course and I will be adding some features to the final revision.

History

June 2005

Aesthetics

  • Added a toolbar to allow for quick access to the application's functions.
  • Added a status bar and a progress bar to communicate with the user.

Functionality

  1. Re-wrote a large portion of the code, which allowed the correction of minor logic flaws.
  2. Corrected an error in packet reception which gave false results.
  3. Added new features to allow the user to adjust some of the program's parameters.
  4. Help file: updated the help file to reflect the changes.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 3 Pin
Vilmair10-May-14 14:25
Vilmair10-May-14 14:25 
Generali get a cross thread operation not allowed Pin
Cool Smith9-Jun-11 22:28
Cool Smith9-Jun-11 22:28 
Generalits throwing an error: Pin
Tejpal Garhwal11-Sep-06 7:39
Tejpal Garhwal11-Sep-06 7:39 
QuestionIt does not work for https that need certificate Pin
Tejpal Garhwal11-Aug-06 6:41
Tejpal Garhwal11-Aug-06 6:41 
AnswerRe: It does not work for https that need certificate [modified] Pin
Tejpal Garhwal11-Aug-06 6:44
Tejpal Garhwal11-Aug-06 6:44 
GeneralRe: It does not work for https that need certificate Pin
aferende11-Aug-06 7:19
aferende11-Aug-06 7:19 
GeneralRe: It does not work for https that need certificate Pin
Tejpal Garhwal11-Aug-06 8:00
Tejpal Garhwal11-Aug-06 8:00 
GeneralRe: It does not work for https that need certificate Pin
DJ BlackEagle30-Oct-06 13:04
DJ BlackEagle30-Oct-06 13:04 
You know, what is ICMP?
When not, look at here: ICMP on wikipedia

http://, https:// and ftp:// is a protocol.

You can only use ICMP for IP-Adress and Domain-Names (and Sub-Domains), an not for http:// oder something.

You can check with ICMP is the server online or not.
When you will is the webserver running, connect to the webserver (exp.: telnet), you get the information is the webserver running or not (or another service use the Port [80, 443]).

The third check you can do, use WebDownload. Download the index.html (or something) and parse the file ro ErrorCode (ErrorCode from the WebServer, not from the Script...).
You think this is to difficult?
The another way is very easy, upload a text file, with the content "CHECK SERVER IS OK".
Download this file, is the content "CHECK SERVER IS OK", the webserver is correct running. But, when you didn't find this content.- The WebServer is not correctly running. The problem of this easy solution, you have not a 100% check. Why? The program, can't say is the content of the website correctly running or not. Wink | ;)

I hope u can understanding, what i mean. Wink | ;)
Generalmain form couldnt be loaded in VS2005 help!! Pin
lizecn10-Aug-06 7:34
lizecn10-Aug-06 7:34 
GeneralI have error Pin
majedsale711-Feb-06 1:38
majedsale711-Feb-06 1:38 
QuestionIs possible to have a LOG file ? Pin
KIM SENG5-Oct-05 5:38
KIM SENG5-Oct-05 5:38 
AnswerRe: Is possible to have a LOG file ? Pin
bill200611-Oct-05 7:29
bill200611-Oct-05 7:29 
GeneralRe: Is possible to have a LOG file ? Pin
KIM SENG12-Oct-05 21:03
KIM SENG12-Oct-05 21:03 
GeneralDelete, Enable/Disable Host Pin
Arbulo8-Jun-05 4:52
Arbulo8-Jun-05 4:52 
GeneralRe: Delete, Enable/Disable Host Pin
Bil20068-Jun-05 4:57
sussBil20068-Jun-05 4:57 
GeneralNice....But what am I doing wrong Pin
GeertD6-Jun-05 20:48
GeertD6-Jun-05 20:48 
GeneralRe: Nice....But what am I doing wrong Pin
Anonymous2-Jul-05 6:20
Anonymous2-Jul-05 6:20 
GeneralRe: Nice....But what am I doing wrong Pin
GeertD12-Jul-05 21:25
GeertD12-Jul-05 21:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.