Ping Program In Vb.net

Filed Under: Ping, Visual Basic Tagged With: ICMP, Network, Ping, Tutorial, VB.net, Visual Basic.net About Brian Dao I am a former United States Paratrooper; served in the 504th Parachute Infantry Regiment of the 82nd Airborne Division back in the 90's.

20 Jul 2007
Yet another Ping Monitor utility written in VB.NET on .NET Framework 2.0

Introduction

This is yet another Ping Monitor utility written in VB.NET on .NET Framework 2.0. It fulfills the need of steadily monitoring through a 'PING' the status (the aliveness) of some PCs and servers on a network, keeping a history of each state transition (ON to OFF and viceversa) and visually highlighting the last status of each machine.

This application is far from being a complete and sophisticated tool. I wrote it for a colleague who needed a starting point for a more advanced and customized tool implementation.

One service, one database, one IU

In order to continuously monitor some machine, we need to have a monitoring EXE continuously runnning. So, I decided to implement the 'monitor engine' as a Windows Service application (taking advantage of unattended execution, automatic restart in case of power failure, and so on). This PingMonitorService simply has to:

  • read from some configuration storage (such as a database table) the list of machines to be monitored (along with the monitoring frequency);
  • execute the actual monitoring sending a 'PING' to each machine configured as to be monitored;
  • log the outcome of each 'PING' somewhere.

Other than a Windows Service for the monitoring and a database as a storage, we obviously need also a user interface (UI) to interact with the configuration and the log; that's why I created a simple Windows Form application (named PingMonitor) to accomplish these tasks: showing the last PING status of the monitored machines and editing the PingMonitorService configuration.

I decided to use a SQL Server 2000 (or 2005) database to host both the configuration (that is, a list of machines to be monitored) and the log.

The following are the two table schemas, expressed in T-SQL code, with some explanations.

The configuration table

The HostList table will contain the list of the machines to be monitored. For each machine, it stores: the machine name with a unique ID (Host and ID fields), the frenquency of monitoring (PingFreq field, expressed in seconds), a flag indicating if the monitoring is currently activated (DoPing field) and a flag indicating if the specific machine has to be shown in the UI (ShowInMonitor field).

Being able to list a hierarchycal tree enables you to organize the machines to be monitored in groups and subgroups, the HostList table supports the concept of parent-child node relationships (via the IDparent field) and the concept of 'folder' tree nodes, that are intermediate nodes not corresponding to an host but simply being the parent of other nodes (for them, the IsHost flag is not set to 'yes').

The user interface provided by the PingMonitor application allows you to visually edit the tree while directly modifying the underlying HostList table (please, notice that the deletion of nodes and the addition of children nodes is allowed through the context menu on the tree).

The log table

The PingLog table will contain an entry for each detected state transition (ON to OFF or viceversa) for each monitored machine during a monitored period of time. The Host field contains the name of the monitored machine, the RecordingDate field contains a timestamp of the recorded entry and the Status field simply contains the value 'ON' or 'OFF' (respectively indicating a successful and an unsuccessful 'PING').

Some notes about the service

The PingMonitorService has been implemented on the standard Windows Service application template of Visual Studio 2005. Being a standard .NET Windows Service, it has to be installed through the installutil.exe utility (see here for reference).

When started, the service reads its CONFIG file in order to retrieve:

Program
  1. the connection string to the configuration database (see ConnStr appSetting)
  2. the configuration reloading frequency (see ReloadConfigFrequency appSetting): it indicates the number of seconds before reloading all the configuration parameters (this enables the service to adapt its behavior based on new settings in the HostList table eventually modified by the user through the PingMonitor UI).

To determine if it's time to 'PING' a machine, the service simply looks at the total number of seconds passed after midnight and checks if this number is a multiple of the specific PingFreq for that host (notice that only status transitions are stored, not each status detection).

Notice that the polling interval in the MainTask() is currently set to 900ms, to be sure that at least one 'tick' happens for every second (obviously, it could occur twice in some seconds). If the host list is very very big, the execution of the TryPing() method could be long enough to make the service miss some 'PING' to some hosts (so please carefully configure the hosts list and the specific PingFreqs).

The 'PING' itself is done, in a very simple way, through the System.Net.NetworkInformation.Ping class:

Some notes about the UI

The UI application is very simple; it consists of two forms: the monitoring form and the configuration form.

The application needs a CONFIG file where the connection string to the support database is specified (see ConnStr appSetting).

The monitoring form is just a DataGridView populated by a query on the PingLog table; the query is designed to show only the last entry for each host having ShowInMonitor='Y'.

The refresh frequency for the DataGridView can be specified in the ReloadFrequency appSetting of the application configuration file. Entries with an 'OFF' status are highlighted by simply implementing the CellFormatting() event handler:

The configuration form contains a treeview with a detail panel, shown when a host node is selected (see the first picture in the article).

No special remarks needed on this. Just notice that the update of the underlying HostList table is done immediately after modifying values on the UI controls, through updates on the corresponding DataTable suddenly written down by the DataAdapter.

Conclusions

As stated in the Introduction, this application is to be considered as a starting point for a more advanced and customized tool implementation. Its basic idea and implementation are intentionally very simple, hoping it can be useful for you in building something more complex.

Vb Net Sample Programs

Downloads

Content of the downloadable ZIP (now available also in a C# version) for this article:

  • the DBTablesCreation.sql file - contains the T-SQL scripts for creating support database tables on Microsoft SQL Server 2000/2005;
  • the PingMonitorService folder - contains the Visual Studio 2005 project for the service;
  • the PingMonitor folder - contains the Visual Studio 2005 project for the UI WinForm application.
Multimedia |Business |Messengers |Desktop |Development |Education |Games |Graphics |Home |Networking |Security |Servers |Utilities |Web Dev| Other
Sort by: Relevance

Graphical Ping

Graphical Ping displays a color-coded real time graph of continuous pings to a specified host. A graphical Windows ping utility written in C# that allows you to log and graph ICMP response from multiple hosts. Includes a C# class library for ICMP and ping to use in your own program.

Programs for vb
  • Publisher: Mark Griffiths
  • Home page:www.gping.com
  • Last updated: July 17th, 2013

Ping Ping Hamster

Ping Ping Hamster introduces a cute little character who is, obviously, a hamster. It has to make use of a rope to climb trees and upper floors. You will need to be witty and devise a strategy for climbing: it's not as easy as it sounds. Remember: you're using the hamster's rope to do this.

  • Publisher: PhysicsGames24.com
  • Home page:www.nowstat.com
  • Last updated: November 11th, 2009

Utility Ping

Utility Ping is a handy and powerful ping utility for system administrator or webmaster to check network connection, intended to replace the standard ping program that comes with Microsoft Windows for ever.

  • Publisher: QKSoft
  • Home page:www.qksoft.com
  • Last updated: April 17th, 2012

Konst Pinger

Konst Pinger is a simple program that has the ability of pinging and tracing an Internet host. The program shows the results in a graph that allows you to understand them better and also saves them in a log file by host name or the one you select. The user interface is not really attractive, but very simple and intuitive, especially for novice users

  • Publisher: VisualSoft
  • Last updated: June 2nd, 2017

Visual Ping monitor

Visual Ping monitor - Simple program to monitor speed of ping. Build temporary graphics.

  • Publisher: Vladimir C
  • Last updated: June 3rd, 2010

Visual Ping

Visual Ping is intended to graphically show the state of a network. When you start the pinging process, you will get the results both textually and graphically. This is extremely useful because it will give you a visual idea of the system. You will also find summary information about the whole process.

  • Publisher: IT Lights Software
  • Home page:www.ITLights.com
  • Last updated: March 14th, 2008

PingUtil

This tool is written in C# and allows the user to log and graph ICMP respones from multiple hosts. The program has the ability to ping flood (i.e. spend a ping without waiting for a response before sending the next ping, will use up all CPU resources).

  • Publisher: PingUtil
  • Home page:sourceforge.net
  • Last updated: January 18th, 2010

VyprVPN for Windows

The VyprVPN for Windows application automatically configures and simplifies managing your VPN connections. Switch freely between over 50+ global server locations and VPN protocols with a single click. VyprVPN is a free VPN app for all devices.

  • Publisher: Golden Frog Inc.
  • Home page:www.vyprvpn.com
  • Last updated: June 28th, 2019

PingGraph

Track your connectivity, latency and bandwidth to multiple hosts at a glance with detailed graphs. Identify saturated links, lost packets, and outages. The latest minor update was to fix a startup issue which showed up on some systems. It is more stable and traps more error conditions such as bogus host names now.

  • Publisher: Infix Technologies
  • Last updated: March 16th, 2015

PingHurry

PingHurry is a free visual ping tool with a flat and 3D graph window or console list overview. With PingHurry a ping/trace/reverse lookup/TCP port scan task is one hotkey away, just show/hide the PingHurry window by using the hotkey or system tray icon

  • Publisher: Adminscope
  • Home page:www.adminscope.com
  • Last updated: September 18th, 2015

Colasoft Ping Tool

Colasoft Ping Tool supports ping multiple IP addresses simultaneously and lists the comparative responding times in a graphic chart, which makes it outstanding other ping tools. The Ping Summary window provides basic information such as IP address, locations, packets received/sent/lost, as well as response time of all required IP addresses or domain names.

  • Publisher: Colasoft Co., Ltd.
  • Home page:www.colasoft.com
  • Last updated: July 2nd, 2018

Ping-Probe

Ping-Probe offers ten top quality networking tools. Each of the tools offers a modern interface with high performance, flexible functionality. An useful tool to anyone connected to the internet. The features include: Ping, Traceroute, TCP Port Scanner, Network Scanner, SNMP Browser, and Bandwidth Monitor.

  • Publisher: Warren Flemmer
  • Last updated: March 6th, 2015

Graph

Graph is an open source application that can be used to draw mathematical graphs in a coordinate system. The program makes it very easy to visualize a function and paste it into another program. It is also possible to do some mathematical calculations on the functions.

  • Publisher: Ivan Johansen
  • Home page:www.padowan.dk
  • Last updated: January 21st, 2013

Ping Monitor

Ping Monitor is a handy Windows desktop gadget that offers a simple, straightforward and reliable solution to track a website, server, domain or IP address, using the ackownledged and reliable method of pinging that location. Using this neat little gadget you can monitor up to five local or remote servers and you can also choose the time interval when these servers get pinged.

  • Publisher: Bushin SOFTWARE, Igor 'Igogo' Bushin
  • Home page:www.myfavoritegadgets.info
  • Last updated: November 29th, 2016

yEd Graph Editor

yEd is a powerful diagram editor that can be used to quickly and effectively generate high-quality drawings of diagrams.Create your diagrams manually or import your external data for analysis and auto-magically arrange even large data sets by just pressing a button.

  • Publisher: yWorks GmbH
  • Home page:www.yworks.com
  • Last updated: December 26th, 2016

GetData Graph Digitizer

GetData Graph Digitizer is a program built for getting raw data out of visual graphs for analytical purposes. Most of the comparative data are usually visualized by graphs and charts. This software helps you in converting these visual data in to figures and export in to sheets in desired formats.

  • Publisher: getdata-graph-digitizer
  • Home page:getdata-graph-digitizer.com
  • Last updated: December 17th, 2012

Ping Tester

Ping Tester easily and effortlessly allows you to perform ping checks for one specific IP or a group of IP addresses. You can add individual IP addresses, groups of them and even URLs. Probably its handier feature is the “Schedule for IP scanning”. This function allows for periodic checks of a given set of IPs.

Vb Net Programming Code

  • Publisher: AutoBAUP Corp.
  • Home page:www.pingtester.net
  • Last updated: April 21st, 2008

Ping-Pong

Programs For Vb

Ping Pong or table tennis is a racket sport that can be played by two or four players. Now MyPlayCity gives us the option to play this particular game on our computers, providing us with a free 3D simulator, where we can feel the excitement of the game in a virtual world.

Vb Net Download

  • Publisher: MyPlayCity, Inc.
  • Home page:www.myplaycity.com
  • Last updated: June 27th, 2009

Using In Vb Net