Click here to Skip to main content
13,147,183 members (26,924 online)
Click here to Skip to main content
Add your own
alternative version


34 bookmarked
Posted 9 Feb 2007

A C# Ping Control

, 9 Feb 2007
Rate this:
Please Sign up or sign in to vote.
This source code/control is provided to make it easy for programmers in C# to ping remote hosts and get the response time in milliseconds.

Sample image


This control (with such an original name as DBnetPing 1.1!) has been designed to wrap the functionality of building an ICMP ping packet, sending it, and timing the response to give you an accurate ping time in milliseconds.


Simply drop the control onto your form and call the function:

results = dBnetPing1.pingHost(txtHost.Text);

results is a simple class that lets you call GetResponseTimeMS which returns an int containing (yep - you guessed it) the response time in milliseconds:

MessageBox.Show("Ping successfull! " + results.GetResponseTimeMS().ToString() + 
    " ms", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);


I created this function/wrapper heavily based on already existing C# code; unfortunately, I do not remember the author. If anyone can help me here, I'd be glad to add. Kudos.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Europe Europe
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralNo Source code Pin
Danilo Corallo8-Nov-07 4:50
memberDanilo Corallo8-Nov-07 4:50 
Generalusage in VC++ 6.0 Pin
12kaunas1-Mar-07 9:58
member12kaunas1-Mar-07 9:58 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.170915.1 | Last Updated 9 Feb 2007
Article Copyright 2007 by daniel.byrne
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid