TsgcWSPClient_FilesEvents › OnFileSentFragmentRequest

OnFileSentFragmentRequest Event

Fires each time the client is about to send a new outbound file fragment; ideal for upload progress and cancellation.

Syntax

property OnFileSentFragmentRequest: TsgcWSFileFragmentRequestEvent;
// TsgcWSFileFragmentRequestEvent = procedure(const aMessage: TsgcWSMessageFile; var Cancel: Boolean) of object

Default Value

Remarks

aMessage.FilePosition tells you how many bytes have already been pushed, aMessage.FileSize the total length. Set Cancel to True to abort: the sent stream and QoS queue entry are released and an error is reported through OnFileSentError. Fires only for qosLevel2 fragmented uploads.

Example

procedure TForm1.oProtocolFileSentFragmentRequest(const aMessage: TsgcWSMessageFile;
  var Cancel: Boolean);
begin
  ProgressBar1.Position := Round(aMessage.FilePosition / aMessage.FileSize * 100);
end;

Back to Events