TsgcQUICServer › Properties › AlwaysMultiStream
Enables multi-stream mode, so the server accepts and reads every stream the peer opens, not just the first one.
property AlwaysMultiStream: Boolean read FAlwaysMultiStream write FAlwaysMultiStream;
False
QUIC multiplexes many streams over one connection. By default the server uses a deliberately simple single-stream model: it adopts the first bidirectional stream the peer opens as the connection's default data stream, delivers its bytes through OnQUICData, and ignores any further streams the peer opens.
Setting AlwaysMultiStream to True changes that for every connection. The server then also accepts each additional peer-opened stream, tracks it as a TsgcQUICServerStream in the connection's Streams list, and delivers its bytes through OnQUICStreamData, tagged with the stream id. This is what you need when the peer sends unidirectional control streams, or opens several bidirectional streams to run requests concurrently.
Multi-stream mode also changes how a stream ending is handled. In single-stream mode, a peer finishing the default stream is treated as the end of the connection and raises OnQUICDisconnect. In multi-stream mode the default stream is simply released and the connection stays alive, so subsequent streams continue to be served.
The property is the switch behind the protected DoMultiStreamEnabled virtual method, which descendants may override to decide per connection. TsgcHTTP3Server sets AlwaysMultiStream := True in its constructor and overrides that method accordingly, because HTTP/3 requires the client's unidirectional control and QPACK streams (RFC 9114) to be received. Do not clear it on an HTTP/3 server.
This member is currently available in the Delphi/C++Builder implementation only. The .NET implementation reads only the first inbound stream per connection and exposes no multi-stream surface.
oServer := TsgcQUICServer.Create(nil);
oServer.Port := 4433;
oServer.QUICOptions.SSLOptions.CertFile := 'cert.pem';
oServer.QUICOptions.SSLOptions.KeyFile := 'key.pem';
// accept and read every stream the peer opens
oServer.AlwaysMultiStream := True;
oServer.OnQUICStreamData := OnQUICStreamDataEvent;
oServer.Start;
procedure TfrmServer.OnQUICStreamDataEvent(Sender: TObject;
const aConnection: TsgcQUICServerConnection; aStreamId: Int64;
aUnidirectional: Boolean; const aData: TBytes);
begin
Log(Format('%d bytes on stream %d (uni=%s)',
[Length(aData), aStreamId, BoolToStr(aUnidirectional, True)]));
end;