TsgcQUICServer › Methods › ConnectionCount

ConnectionCount Method

Returns the number of QUIC connections the server is currently tracking.

Syntax

function ConnectionCount: Integer;

Return Value

The number of connections the server is currently tracking, or 0 when it is stopped or no peer is connected (Integer).

Remarks

Returns the number of entries in the server's Connections list, so it counts the sessions the listener thread is servicing. Unlike reading Connections.Count, it does not force the list to be created when the server has never accepted anything.

A connection is counted from the moment it is accepted, which is before OnQUICConnect fires for it. The connect notification is deliberately deferred until the peer opens its first stream, so during that window the connection is already counted but has not been announced. It is removed from the count when the session closes.

This is also the value the server compares against QUICOptions.MaxConnections when deciding whether to accept a new connection, so with a limit of N the count never exceeds N.

Example


Log('Active QUIC connections: ' + IntToStr(oServer.ConnectionCount));

Back to Methods