TsgcHTTP3Client › Methods › TunnelPump

TunnelPump Method

Pumps the QUIC event loop so tunnel data is read and delivered on OnTunnelData.

Syntax

procedure TunnelPump(aTimeoutMs: Integer);

Parameters

NameTypeDescription
aTimeoutMsIntegerHow long to pump, in milliseconds. Pass 0 or a negative value for a single non-blocking pass.

Return Value

None. Received bytes are delivered on OnTunnelData.

Remarks

A tunnel has no background reader thread, so incoming DATA frames are only picked up while the caller drives the QUIC event loop. TunnelPump does exactly that: it reads from the connection until aTimeoutMs has elapsed, firing OnTunnelData for each DATA frame that arrives on the tunnel stream.

Call it periodically from a timer or a dedicated thread for as long as the tunnel is open. Passing 0 performs a single non-blocking read pass, which suits a tight polling loop that also has other work to do.

The method returns immediately when the client is not connected.

This member is currently available in the Delphi/C++Builder implementation only.

Example



// drive the tunnel for one second

oClient.TunnelPump(1000);



// or a single non-blocking pass inside a loop

while vRunning do

begin

  oClient.TunnelPump(0);

  Application.ProcessMessages;

end;

Back to Methods