Internet Direct (Indy)
Home
PreviousUpNext
TIdIcmpClient.Ping Method

Sends an echo request and receives an echo response.

Pascal
procedure Ping(
    const ABuffer: String = ''; 
    SequenceID: word = 0
);
Parameters 
Description 
ABuffer 
Optional data to be sent in the ping request.
 
SequenceID 
Uniqueness Identifier for the Ping request. Default value is 0. 

Ping is a procedure used to prepare and send an echo request datagram, and to receive the echo response. Ping sends the echo request to the computer identified in Host, and gets the response to the echo request datagram. 

ABuffer is an optional string that contains values to be sent in the content of the Ping request. 

SequenceID is a Word value used as a packet identifier for the Ping request. SequenceID is also used when decoding the response packets for a Ping request. When SequenceID contains a non-zero value, it is used to match an echo response to the original ping request with the same sequence identifer. SequenceID can be set to a unique value to identify a specific Ping request and/or response. 

Set ReceiveTimeout to indicate the time to wait for a response to the echo request datagram. 

Use ReplyStatus to access identification, diagnostic, and statistical information received in a response to an echo request datagram. 

Assign an OnReply event handler to perform additional processing when a TOnReplyEvent is triggered during processing for a Ping response. 

The socket handle allocated for sending and receiving datagram packets in Ping is closed prior to completion of the method. 

 

For Windows NT and Windows 2000, administrator privileges are required to allow TIdICMPClient.Ping to work properly. The command line PING application does not exhibit this behavior because Microsoft chose to use undocumented calls in ICMP.DLL and its winsock implementation to get around the issue. In short: they cheated. Indy does not use ICMP.DLL to maintain Linux compatibility, and allow use of both Raw sockets and ICMP sockets.

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.