Click here to Skip to main content
Licence 
First Posted 28 Apr 2005
Views 66,530
Bookmarked 25 times

Ping Control

By | 28 Apr 2005 | Article
This article describes a Ping control.

Introduction

Add a Ping control to your form and set the following properties:

  1. The IP-address to ping.
  2. The terminal type (Server, Router, Desktop, ….).
  3. The e-mail address of the person who will be notified when the remote host does not respond.
  4. The short description of the remote host.
  5. The ping interval.
  6. Write a log file - Yes or No. The log file can be viewed and printed.

Controls can be added to build a visual representation of your network.

When a remote host does not respond, the image will change, a warning message will be displayed and a log will be generated with the date and time. The e-mail recipient will also be notified.

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

About the Author

HendrikO

Web Developer

South Africa South Africa

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionHow do I use the code. Pinmember8AVEGA21:01 5 Feb '09  
Generalvb.net Pinmembersrikanth goud20:40 27 Sep '07  
GeneralProblem using the ping control in a multthreaded app. PinmemberDTJeff5:59 14 Jul '05  
GeneralRe: Problem using the ping control in a multthreaded app. Pinmemberantoine_raymond2:22 19 Feb '07  
GeneralRe: Problem using the ping control in a multthreaded app. PinmemberDTJeff3:23 19 Feb '07  
Hi
 
I never did find a solution as such, but I did write some code which (in my opinion anyway) worked better.
 
This is the code:
 

Public Function PingIPAddress(ByVal Destination As String) As Boolean
Dim PingInfo As New System.Diagnostics.ProcessStartInfo("ping")
PingInfo.WindowStyle = ProcessWindowStyle.Hidden
'You can change the attempts at a ping by changing the " -n 1" part to a higher number - e.g. " -n 3"
'also possible to add other options here such as "-l 64" ( send 64 bytes of data)
PingInfo.Arguments = Destination & " -n 1"
PingInfo.CreateNoWindow = True
PingInfo.UseShellExecute = False
PingInfo.RedirectStandardOutput = True
Dim SystemProcess As New System.Diagnostics.Process
SystemProcess.StartInfo = PingInfo
SystemProcess.Start()
SystemProcess.WaitForExit()
Dim tmpResult As String
tmpResult = SystemProcess.StandardOutput.ReadToEnd
If InStr(tmpResult, "Reply from") > 0 Then
'Debug.WriteLine("*******************************************")
'Debug.Write(tmpResult)
'Debug.WriteLine("*******************************************")
Return True
Else
'Debug.WriteLine("*******************************************")
'Debug.Write(tmpResult)
'Debug.WriteLine("*******************************************")
Return False
End If
End Function

 
Essentially it calls the DOS ping command and returns the results. It then simply checks for the "Reply from" text (or lack of). I'm sure it will give you the basis for retrieving more info if required.
 
Hope it helps Big Grin | :-D
 
Jeff.
GeneralRe: Problem using the ping control in a multthreaded app. Pinmemberantoineraymond5:33 19 Feb '07  
GeneralPing control Accepts all pings Pinsussmichael ellerbeck6:04 22 Jun '05  
GeneralMultiple pings PinmemberAceoft3:33 10 May '05  
GeneralRe: Multiple pings PinmemberHendrikO20:03 10 May '05  
GeneralRe: Multiple pings PinmemberEgn20:49 28 May '06  

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

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

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120529.1 | Last Updated 29 Apr 2005
Article Copyright 2005 by HendrikO
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid