<PackageReference Include="SSH.NET" Version="2025.1.0" />

SftpSession

Represents an SFTP session.
public uint NextRequestId { get; }

Gets the next request id for sftp session.

public uint ProtocolVersion { get; }

public string WorkingDirectory { get; }

public SftpSession(ISession session, int operationTimeout, Encoding encoding, ISftpResponseFactory sftpResponseFactory)

Initializes a new instance of the SftpSession class.

public uint CalculateOptimalReadLength(uint bufferSize)

Calculates the optimal size of the buffer to read data from the channel.

public uint CalculateOptimalWriteLength(uint bufferSize, byte[] handle)

Calculates the optimal size of the buffer to write data on the channel.

public void ChangeDirectory(string path)

public Task ChangeDirectoryAsync(string path, CancellationToken cancellationToken)

public string GetCanonicalPath(string path)

public Task<string> GetCanonicalPathAsync(string path, CancellationToken cancellationToken)

public void RequestClose(byte[] handle)

public Task RequestCloseAsync(byte[] handle, CancellationToken cancellationToken)

public void RequestFSetStat(byte[] handle, SftpFileAttributes attributes)

public SftpFileAttributes RequestFStat(byte[] handle)

public Task<SftpFileAttributes> RequestFStatAsync(byte[] handle, CancellationToken cancellationToken)

public SftpFileAttributes RequestLStat(string path)

public Task<SftpFileAttributes> RequestLStatAsync(string path, CancellationToken cancellationToken)

public void RequestMkDir(string path)

public Task RequestMkDirAsync(string path, CancellationToken cancellationToken)

public byte[] RequestOpen(string path, Flags flags)

public Task<byte[]> RequestOpenAsync(string path, Flags flags, CancellationToken cancellationToken)

public byte[] RequestOpenDir(string path)

public Task<byte[]> RequestOpenDirAsync(string path, CancellationToken cancellationToken)

public void RequestPosixRename(string oldPath, string newPath)

public byte[] RequestRead(byte[] handle, ulong offset, uint length)

public Task<byte[]> RequestReadAsync(byte[] handle, ulong offset, uint length, CancellationToken cancellationToken)

public KeyValuePair<string, SftpFileAttributes>[] RequestReadDir(byte[] handle)

public Task<KeyValuePair<string, SftpFileAttributes>[]> RequestReadDirAsync(byte[] handle, CancellationToken cancellationToken)

public void RequestRemove(string path)

public Task RequestRemoveAsync(string path, CancellationToken cancellationToken)

public void RequestRename(string oldPath, string newPath)

public Task RequestRenameAsync(string oldPath, string newPath, CancellationToken cancellationToken)

public void RequestRmDir(string path)

public Task RequestRmDirAsync(string path, CancellationToken cancellationToken)

public void RequestSetStat(string path, SftpFileAttributes attributes)

public SftpFileAttributes RequestStat(string path)

public Task<SftpFileSystemInformation> RequestStatVfsAsync(string path, CancellationToken cancellationToken)

public void RequestSymLink(string linkpath, string targetpath)

public void RequestWrite(byte[] handle, ulong serverOffset, byte[] data, int offset, int length, AutoResetEvent wait, Action<SftpStatusResponse> writeCompleted = null)

public Task RequestWriteAsync(byte[] handle, ulong serverOffset, byte[] data, int offset, int length, CancellationToken cancellationToken)