ReadFile Event
This event is fired when a file read request is received.
Syntax
public event OnReadFileHandler OnReadFile; public delegate void OnReadFileHandler(object sender, SftpserverReadFileEventArgs e); public class SftpserverReadFileEventArgs : EventArgs { public long ConnectionID { get; } public string Handle { get; } public int Offset { get; } public int Size { get; } public int OperationStatus { get; set; } }
Public Event OnReadFile As OnReadFileHandler Public Delegate Sub OnReadFileHandler(sender As Object, e As SftpserverReadFileEventArgs) Public Class SftpserverReadFileEventArgs Inherits EventArgs Public ReadOnly Property ConnectionID As Long Public ReadOnly Property Handle As String Public ReadOnly Property Offset As Integer Public ReadOnly Property Size As Integer Public Property OperationStatus As Integer End Class
Remarks
This event is fired when a request to read block from a file is received from the client. The ConnectionID parameter specifies in which session the request was received, and Handle indicates an opened file handle. Offset andSize denote the location and size of the file piece.
Inside the event handler, pass the appropriate file chunk to the component via SetClientBuffer method.
Set OperationStatus to one of the below values according to the outcome of the request processing:
ostOk | 1 | |
ostNoSuchFile | 2 | |
ostAccessDenied | 3 | |
ostWriteProtect | 4 | |
ostUnsupported | 5 | |
ostInvalidParameter | 6 | |
ostEOF | 7 |