Sample code for 30+ languages & platforms
Delphi DLL

Restart Transfer-Rate Measurement

See more Socket/SSL/TLS Examples

Demonstrates Socket.ResetPerf, which restarts one direction of connection-level transfer-rate measurement.

Background. Pass true to reset the receive measurement (RcvBytesPerSec) or false to reset the send measurement (SendBytesPerSec).

Chilkat Delphi DLL Downloads

Delphi DLL
var
success: Boolean;
socket: HCkSocket;
bTls: Boolean;
maxWaitMs: Integer;
bRcvPerf: Boolean;

begin
success := False;

socket := CkSocket_Create();

//  Connect to the server using TLS.
bTls := True;
maxWaitMs := 5000;
success := CkSocket_Connect(socket,'example.com',5000,bTls,maxWaitMs);
if (success = False) then
  begin
    Memo1.Lines.Add(CkSocket__lastErrorText(socket));
    Exit;
  end;

//  Restart one direction of transfer-rate measurement.  Pass 1 to reset the receive measurement
//  (RcvBytesPerSec) or 0 to reset the send measurement (SendBytesPerSec).
bRcvPerf := True;
CkSocket_ResetPerf(socket,bRcvPerf);
Memo1.Lines.Add('Receive-rate measurement restarted.');

CkSocket_Dispose(socket);