TRVCamReceiver.OnReceiveFileData

Top  Previous  Next

The event occur in response to TRVCamSender.SendFile

type // defined in MRVType unit
  TRVFileReadEvent = procedure(Sender: TObject; SessionKey: TRVSessionKey
    FileName: String; FileOffs, TotalFileSize: Int64; 
    AData: TStream; ASocket: TRVSocket
    GUIDFrom, GUIDTo, GUIDGroup: TGUID) of object;

  TRVFileEvent = procedure(Sender: TObject; SessionKey : TRVSessionKey; 
    FileName: String; TotalFileSize: Int64; ASocket: TRVSocket
    GUIDFrom, GUIDTo, GUIDGroup: TGUID) of object;

property OnReceiveFileData: TRVFileReadEvent;

property OnReceivingFile: TRVFileEvent;
property OnReceivedFile: TRVFileEuvent;

OnReceivingFile occurs when the receiver starts to receive a file.

OnReceiveFileData occurs (multiple times) while receiving file data.

OnReceivedFile occurs when a file has been received.

Parameters:

AData – received content

nGUIDFrom – identifier of the sender which sent the command (TRVCamSender.GUIDFrom)

nGUIDGroup – identifier of the group on the server, if this command was sent to a group.

FileName, FileOffs correspond to the parameters of TRVCamSender.SendFile. TotalFileSize – the size of the original file.

 

If you perform time consuming operations inside an event, it makes sense to compare values of SessionKey parameter and SessionKey property, to make sure that a connection was not closed or reopened.

OnReceivingFile and OnReceivedFile are called in the context of the main process.

OnReceiveFileData is called in a thread context. Do not update user interface (or make any other operation that requires a context of the main process) in this event.