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

Renci.SshNet.Sftp.SftpSession

Represents an SFTP session.
namespace Renci.SshNet.Sftp { internal sealed class SftpSession : SubsystemSession, ISftpSession, ISubsystemSession, IDisposable { public string WorkingDirectory { get; } public uint ProtocolVersion { get; } public uint NextRequestId { get; } public SftpSession(ISession session, int operationTimeout, Encoding encoding, ISftpResponseFactory sftpResponseFactory); 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 byte[] RequestOpen(string path, Flags flags); public Task<byte[]> RequestOpenAsync(string path, Flags flags, CancellationToken cancellationToken); public void RequestClose(byte[] handle); public Task RequestCloseAsync(byte[] handle, CancellationToken cancellationToken); public byte[] RequestRead(byte[] handle, ulong offset, uint length); public Task<ReadOnlyMemoryOwner> RequestReadAsync(byte[] handle, ulong offset, uint length, CancellationToken cancellationToken); public void RequestWrite(byte[] handle, ulong serverOffset, byte[] data, int offset, int length, AutoResetEvent wait); public void RequestWrite(SftpWriteRequestBuffer buffer, Action<SftpStatusResponse> writeCompleted); public Task RequestWriteAsync(byte[] handle, ulong serverOffset, byte[] data, int offset, int length, CancellationToken cancellationToken); public SftpFileAttributes RequestLStat(string path); public Task<SftpFileAttributes> RequestLStatAsync(string path, CancellationToken cancellationToken); public SftpFileAttributes RequestFStat(byte[] handle); public Task<SftpFileAttributes> RequestFStatAsync(byte[] handle, CancellationToken cancellationToken); public void RequestSetStat(string path, SftpFileAttributes attributes); public void RequestFSetStat(byte[] handle, SftpFileAttributes attributes); public byte[] RequestOpenDir(string path); public Task<byte[]> RequestOpenDirAsync(string path, 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 RequestMkDir(string path); public Task RequestMkDirAsync(string path, CancellationToken cancellationToken); public void RequestRmDir(string path); public Task RequestRmDirAsync(string path, CancellationToken cancellationToken); public SftpFileAttributes RequestStat(string path); public void RequestRename(string oldPath, string newPath); public Task RequestRenameAsync(string oldPath, string newPath, CancellationToken cancellationToken); public void RequestSymLink(string linkpath, string targetpath); public void RequestPosixRename(string oldPath, string newPath); public SftpFileSystemInformation RequestStatVfs(string path); public Task<SftpFileSystemInformation> RequestStatVfsAsync(string path, CancellationToken cancellationToken); public uint CalculateOptimalReadLength(uint bufferSize); public uint CalculateOptimalWriteLength(uint bufferSize, byte[] handle); } }