TsgcQUICClient › Methods › WriteData
Sends data to the server over the default QUIC stream.
procedure WriteData(const aValue: TBytes); overload;
| Name | Type | Description |
|---|---|---|
aValue | const TBytes | Raw bytes to send to the server over the default QUIC stream. |
Writes the bytes to the default QUIC stream of the active connection. Use this overload when you already hold raw bytes, or when you need an encoding other than UTF-8. Call it once the connection is open, for example from the OnQUICConnect handler or after Connect has returned True.
The call is silently ignored when there is no live connection, so it reports no error if you write too early. It returns as soon as the bytes have been handed to the QUIC stream and does not wait for a reply, so a server that answers nothing no longer leaves the call blocked. In .NET a null array is treated as empty and write errors are routed to OnQUICException.
oClient.WriteData(TEncoding.UTF8.GetBytes('Hello QUIC'));
procedure WriteData(const aValue: String); overload;
| Name | Type | Description |
|---|---|---|
aValue | const String | Text to send to the server over the default QUIC stream. |
Encodes the text as UTF-8 and writes it to the default QUIC stream of the active connection. This is the overload to use when you are sending text and UTF-8 is what you want on the wire. Reach for the TBytes overload when you have raw bytes, or when the payload must be encoded some other way. Call it once the connection is open, for example from the OnQUICConnect handler or after Connect has returned True.
The call is silently ignored when there is no live connection, so it reports no error if you write too early. It returns as soon as the text has been handed to the QUIC stream and does not wait for a reply, so a server that answers nothing no longer leaves the call blocked. In .NET a null value is treated as an empty string.
To send over a stream you opened with OpenStream rather than the default one, use WriteStreamData.
oClient.WriteData('Hello QUIC');