Interface IFileTransfer
Defines the contract for file transfer operations including receiving and sending files.
public interface IFileTransfer : IReferenceable, IDisposable
- Inherited Members
Properties
Direction
Gets the data flow direction (sending or receiving).
MediaFlowDirection Direction { get; }
Property Value
EndPoint
Gets the remote endpoint information.
IPProtoEndPoint EndPoint { get; }
Property Value
ErrorDescription
Gets the error description. Only meaningful if ExecuteAsync(CancellationToken?) returned false or the state is Error.
string ErrorDescription { get; }
Property Value
FileCreatedAt
Gets or sets the file creation date and time. For receivers, this exposes the received file's creation date when present. For senders, this can be used to set the creation date when a user-defined stream is specified; otherwise ignored.
DateTime? FileCreatedAt { get; set; }
Property Value
FileModifiedAt
Gets or sets the file modification date and time. For receivers, this exposes the received file's modification date when present. For senders, this can be used to set the modification date when a user-defined stream is specified; otherwise ignored.
DateTime? FileModifiedAt { get; set; }
Property Value
FilePath
Gets or sets the local file path to read from or write to. Either FilePath or Stream must be set, but not both.
string FilePath { get; set; }
Property Value
InstanceId
Gets or sets the unique identifier for this transfer instance.
Guid InstanceId { get; set; }
Property Value
State
Gets the current file transfer state.
MediaState State { get; }
Property Value
Stream
Gets or sets the stream to read from or write to. Either FilePath or Stream must be set, but not both.
Stream Stream { get; set; }
Property Value
Uri
Gets or sets the server URI for the file transfer.
string Uri { get; set; }
Property Value
Methods
ExecuteAsync(CancellationToken?)
Executes the file transfer asynchronously.
Task<bool> ExecuteAsync(CancellationToken? cancellationToken = null)
Parameters
cancellationTokenCancellationToken?An optional cancellation token to cancel the transfer.
Returns
- Task<bool>
A task that returns true if the transfer completed successfully; otherwise, false. In case of an error, the detailed description is available in the ErrorDescription property.
Events
StateChanged
Occurs when the transfer state changes.
event EventHandler<MediaState> StateChanged