TsgcTURNClientMethods › WriteData

WriteData Method

Writes raw bytes directly on the underlying TURN transport; used for custom payloads and diagnostics.

Overloads

Overload 1

Syntax

procedure WriteData(const aBytes: TBytes);

Parameters

NameTypeDescription
aBytesconst TBytesBytes to write verbatim on the transport to the configured Host/Port.

Remarks

Low-level escape hatch that writes the byte array directly on the socket connected to the TURN server without any STUN/TURN framing. Intended for diagnostics, custom attribute experiments and for replaying captured traces. Typical applications should use SendIndication or SendChannelData instead.

Example

var
  vRaw: TBytes;
begin
  vRaw := TEncoding.UTF8.GetBytes('diagnostic');
  oTURN.WriteData(vRaw);
end;

Overload 2

Syntax

procedure WriteData(const aIPAddress: string; aPort: Word; const aBytes: TBytes);

Parameters

NameTypeDescription
aIPAddressconst stringDestination IP address; useful when the UDP socket talks to multiple endpoints.
aPortWordDestination UDP port.
aBytesconst TBytesBytes to write verbatim on the transport towards aIPAddress:aPort.

Remarks

Variant that targets an explicit destination instead of the configured Host/Port. Used internally when the allocation needs to address a different server (for example after a 300 Try Alternate redirect) and exposed here for advanced scenarios such as hairpinning tests.

Example

oTURN.WriteData('198.51.100.10', 3478, vRaw);

Back to Methods