Indy 9
TIdEchoUDP
Hierarchy, Properties, Methods, Events, See Also, Unit: IdEchoUDP
Implements an Echo client.
TIdEchoUDP = class(TIdUDPClient)
Unit
IdEchoUDP
Description
TIdEchoUDP implements the UDP-based variant of the Echo Protocol as described in the Internet Standards document RFC 862 - Echo Protocol (http://www.rfc-editor.org/rfc/rfc862.txt) .

TIdEcho is a TIdUDPClient descendant that is a useful debugging and measurement protocol where the data sent to the server is simply sent back to the originating client. TIdEchoUDP is provided as a measure of the time it takes to send and receive data from an Echo Server (TIdEchoUDPServer).

The UDP-based implementation of the Echo Protocol is a connection-less facility. An Echo Server listens for data arriving on Port 7. When an echo request is received, any data is returned to the originating client.

To use TIdEchoUDP, perform the following actions in your application:

  • Set the Host property to the address for the Echo server.

  • Call Echo to send data to the server and receive the server response.

  • Use EchoTime to retrieve the number of milliseconds needed to send and receive data from the server.

TIdEchoUDP.EchoTime
TIdEchoUDP, See Also
Indicates the elapsed time needed to send and receive echo data.
property EchoTime: Cardinal;
Description
EchoTime is a Cardinal property that indicates the number of milliseconds required to send and receive data using the Echo method. Use EchoTime to determine when there may be problems with the network or connection.

EchoTime is calculated using GetTickDiff, from IdGlobal.pas, and represents the elapsed milliseconds from the start of the echo request until completion of the echo response. EchoTime is adjusted to reflect situations where GetTickCount reverts to a 0 (zero) value after the Echo transmission has been started.


TIdEchoUDP.Port
TIdEchoUDP, See Also
Port number for the ECHO protocol.
property Port: Integer;
Description
Port is an Integer property that represents the port number used by the ECHO protocol. Port is redefined in TIdEchoUDP to establish the default port number (IdPORT_ECHO) for the protocol client.

TIdEchoUDP.Create
TIdEchoUDP, See Also
Constructor for the object instance.
constructor Create(AOwner: TComponent); override;
Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create is the constructor for the object instance, and calls the inherited Create method. Create sets the value in Port to the constant value IdPORT_ECHO (Decimal 7) as required by the Echo Protocol.

An application must initialize Host prior to sending data using the Echo method.


TIdEchoUDP.Echo
TIdEchoUDP, See Also
Sends and receives echo data.
function Echo(AText: String): String;
Parameters
AText: String
Data to send to the echo server.
Return Value
String - Data received from the echo server.
Description
Echo is a String function that sends the text in AText to the echo server, and returns the text received from the echo server. If the returned value is not the same as the text in AText, there may be a problem with the server or the network.

Echo monitors the time needed to send the echo request and receive the echo response, and stores the elapsed time in EchoTime. Echo uses GetTickDiff, from IdGlobal.pas, to retrieve both the starting and ending milliseconds measurements used to determine EchoTime. Echo can account for TickCount reverting to a 0 (zero) value after starting the Echo transmission.


Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.