Indy 9
|
TIdEcho = class(TIdTCPClient)
TIdEcho is a TIdTCPClient descendant that is a useful debugging and measurement protocol where the data sent to the server is simply sent back to the originating client. TIdEcho is provided as a measure of the time it takes to send and receive data from an Echo Server (TIdECHOServer).
The TCP-based implementation of the Echo Protocol is a connection based application. An Echo Server listens for TCP connections on TCP Port 7. When a connection is established, any received data is returned to the originating client. The connection continues until the client application closes the connection.
To use TIdEcho, perform the following actions in your application:
property EchoTime: Cardinal;
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 the elapsed time reverts to a 0 (zero) value after the Echo transmission has been started.
property Port: integer;
constructor Create(AOwner: TComponent); override;
An application must initialize Host and call Connect prior to sending data using the Echo method. Call Disconnect prior to freeing the object instance.
function Echo(AText: String): String;
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 the elapsed time reverting to a 0 (zero) value after starting the Echo transmission.