TsgcQUICClient › Methods › WriteStreamData

WriteStreamData Method

Writes application bytes to a specific QUIC stream opened with OpenStream.

Syntax

procedure WriteStreamData(const aStream: TsgcQUICClientStream; const aData: TBytes);

Parameters

NameTypeDescription
aStreamconst TsgcQUICClientStreamThe target stream, previously returned by OpenStream or received through OnQUICStreamData. Must not be a unidirectional stream opened by the peer, which the client cannot write to.
aDataconst TBytesRaw bytes to send over the stream.

Remarks

WriteStreamData sends the supplied bytes over one specific QUIC stream instead of the default one. The call is silently ignored when there is no live connection or when SSLQUIC is False, so it reports no error if you call it before connecting.

Open the stream with OpenStream on an established connection, having called EnableMultiStream first. QUIC delivers each stream in order and independently of the others, so a lost packet on one stream does not delay the rest. QUIC does not preserve application message boundaries, so if your protocol needs framing you must add it yourself, the peer may read your bytes back in different sized chunks.

To send over the default stream instead, use WriteData.

This member is currently available in the Delphi/C++Builder implementation only, and it requires the builtin OpenSSL QUIC engine.

Example


var
  oStream: TsgcQUICClientStream;
begin
  oClient.EnableMultiStream;

  oStream := oClient.OpenStream;
  if Assigned(oStream) then
    oClient.WriteStreamData(oStream, TEncoding.UTF8.GetBytes('Hello QUIC'));
end;

Back to Methods