CPing logoCPing v1.53

Welcome to CPing, a freeware C++ class to encapsulate the "Ping" on Windows

Features
Usage
History
API Reference
Contacting the Author

 

 

 

Features

 

 

 

Usage

 

 

 

History

v1.53 (18 March 2022)

v1.52 (10 December 2021)

v1.51 (30 March 2021)

v1.50 (28 March 2020)

v1.49 (29 December 2019)

v1.48 (10 November 2019)

v1.47 (3 May 2019)

v1.46 (3 November 2018)

v1.45 (26 December 2017)

v1.44 (8 May 2016)

v1.43 (6 May 2016)

v1.42 (2 May 2016)

v1.41 (7 June 2008)

v1.40 (10 July 2006)

v1.39 (31 July 2005)

v1.38 (31 July 2005)

v1.37 (11 June 2005)

v1.36 (12 April 2004)

v1.35 (23 November 2003)

27 June 2003

v1.34 (13 March 2003)

v1.33 (10 March 2003)

v1.32 (22 November 2002)

v1.31 (5 May 2002)

v1.3 (25 February 2002)

v1.24 (12 January 2002)

v1.23 (15 July 2001)

v1.22 (1 March 2000)

v1.21 (9 November 1998)

v1.2 (30 July 1998)

v1.1 (23 June 1998)

v1.0 (11 June 1998)

 

 

 

 

API Reference

The API consists of the various public members of the class CPing

 

CPing::PingUsingICMP

bool CPing::PingUsingICMPv4(LPCTSTR pszHostName, CPingReplyv4& pr, UCHAR nTTL = 10, DWORD dwTimeout = 5000, WORD wDataSize = 32, UCHAR nTOS = 0, bool bDontFragment = false, bool bFlagReverse = false, LPCTSTR pszLocalBoundAddress = nullptr) const

bool CPing::PingUsingICMPv6(LPCTSTR pszHostName, CPingReplyv6& pr, UCHAR nTTL = 10, DWORD dwTimeout = 5000, WORD wDataSize = 32, UCHAR nTOS = 0, bool bDontFragment = false, bool bFlagReverse = false, LPCTSTR pszLocalBoundAddress = nullptr) const

Return Value

If the function succeeds, the return value is true. If the function fails, the return value is false. To get extended error information, call ::GetLastError.

Parameters

pszHostName The network address of the socket to connect to: a machine name such as “www.somedomain.com”, or a dotted number such as “128.56.22.8” will both work.

pr This is a reference to a structure which will be filled in upon successful return of this function. Currently it contains:

    Address     This is the IP address of the replier

   RTT    This is the round trip time in Milliseconds

   EchoReplyStatus The status value from the ping 

   Reply Contains the raw ICMP_ECHO_REPLY / ICMPV6_ECHO_REPLY structure representing the ICMP echo reply

dwTimeout This is the timeout to use for connections in milliseconds.

nTTL This is the time to live of the ICMP packet to be sent. For those unfamiliar with the low level details of IP, this is the maximum number of routers through which this packet should travel. Each time an IP packet goes through a router, its TTL value is decremented by 1. Eventually when a packet is received with a TTL of 1, it is not forwarded and instead an ICMP reply is generated. This prevents the network from becoming flooded with old IP packets. As an aside this is the basis of how traceroute is implemented.

wDataSize This is the size of the data to transmit in the ICMP packet.

nTOS The Type of Service IP header field to use

bDontFragment Sets the Don't fragment IP header field

bFlagReverse Sets the Flag Reverse IP header field

pszLocalBoundAddress The local address to bind the request to

Remarks

Internally these functions will use the Iphlpapi dll to do a ping. The "v4" method supports a IPv4 ping while the "v6" method will do a IPv6 ping.

 

 

 

Contacting the Author

PJ Naughter
Email: pjna@naughter.com
Web: http://www.naughter.com
18 March 2022