TsgcWSPServer_FilesMethods › SendFile

SendFile Method

Sends a file to a single connected client identified by its connection guid.

Overloads

Overload 1

Syntax

procedure SendFile(aGuid, aFileName: string; aSize: Integer; aQoS: TwsQoS; aData: String; aFileId: String = '');

Parameters

NameTypeDescription
aGuidstringGuid of the target client connection.
aFileNamestringFull path to the file that will be sent.
aSizeIntegerSize in bytes of every packet the file is chunked into.
aQoSTwsQoSQuality of service: qosLevel0 (fire-and-forget), qosLevel1 (acknowledged) or qosLevel2 (acknowledged + fragment-requested).
aDataStringOptional user data travelling with the file header; forwarded to the receiver in the message metadata.
aFileIdStringOptional file identifier; auto-generated when left empty.

Remarks

Full overload with explicit buffer size and QoS. For qosLevel0 / qosLevel1 the server streams the file to the client; for qosLevel2 the server waits for the receiver to request fragments so interrupted transfers can be resumed.

Example

oFiles.SendFile(aConnection.Guid, 'C:\Docs\report.pdf', 32768, qosLevel2, 'invoice', '');

Overload 2

Syntax

procedure SendFile(aGuid, aFileName: string);

Parameters

NameTypeDescription
aGuidstringGuid of the target client connection.
aFileNamestringFull path to the file that will be sent.

Remarks

Convenience overload that uses Files.BufferSize and Files.QoS.Level as defaults and sends the file with no accompanying user data.

Example

oFiles.SendFile(aConnection.Guid, 'C:\Docs\report.pdf');

Back to Methods