<PackageReference Include="SSH.NET" Version="2024.2.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 = default(CancellationToken)); public string GetCanonicalPath(string path); public Task<string> GetCanonicalPathAsync(string path, CancellationToken cancellationToken); public ISftpFileReader CreateFileReader(byte[] handle, ISftpSession sftpSession, uint chunkSize, int maxPendingReads, long? fileSize); public byte[] RequestOpen(string path, Flags flags, bool nullOnError = false); public Task<byte[]> RequestOpenAsync(string path, Flags flags, CancellationToken cancellationToken); public SftpOpenAsyncResult BeginOpen(string path, Flags flags, AsyncCallback callback, object state); public byte[] EndOpen(SftpOpenAsyncResult asyncResult); public void RequestClose(byte[] handle); public Task RequestCloseAsync(byte[] handle, CancellationToken cancellationToken); public SftpCloseAsyncResult BeginClose(byte[] handle, AsyncCallback callback, object state); public void EndClose(SftpCloseAsyncResult asyncResult); public SftpReadAsyncResult BeginRead(byte[] handle, ulong offset, uint length, AsyncCallback callback, object state); public byte[] EndRead(SftpReadAsyncResult asyncResult); public byte[] RequestRead(byte[] handle, ulong offset, uint length); public Task<byte[]> RequestReadAsync(byte[] handle, ulong offset, uint length, CancellationToken cancellationToken); 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); public SftpFileAttributes RequestLStat(string path); public Task<SftpFileAttributes> RequestLStatAsync(string path, CancellationToken cancellationToken); public SFtpStatAsyncResult BeginLStat(string path, AsyncCallback callback, object state); public SftpFileAttributes EndLStat(SFtpStatAsyncResult asyncResult); public SftpFileAttributes RequestFStat(byte[] handle, bool nullOnError); 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, bool nullOnError = false); 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 = default(CancellationToken)); public void RequestRmDir(string path); public Task RequestRmDirAsync(string path, CancellationToken cancellationToken = default(CancellationToken)); public SftpRealPathAsyncResult BeginRealPath(string path, AsyncCallback callback, object state); public string EndRealPath(SftpRealPathAsyncResult asyncResult); public SftpFileAttributes RequestStat(string path, bool nullOnError = false); public SFtpStatAsyncResult BeginStat(string path, AsyncCallback callback, object state); public SftpFileAttributes EndStat(SFtpStatAsyncResult asyncResult); 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, bool nullOnError = false); public Task<SftpFileSystemInformation> RequestStatVfsAsync(string path, CancellationToken cancellationToken); public uint CalculateOptimalReadLength(uint bufferSize); public uint CalculateOptimalWriteLength(uint bufferSize, byte[] handle); } }