C# Class Renci.SshNet.Sftp.SftpSession

Inheritance: SubsystemSession, ISftpSession
ファイルを表示 Open project: sshnet/SSH.NET Class Usage Examples

Public Methods

Method Description
CalculateOptimalReadLength ( uint bufferSize ) : uint

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

CalculateOptimalWriteLength ( uint bufferSize, byte handle ) : uint

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

Currently, we do not take the remote window size into account.

ChangeDirectory ( string path ) : void

Changes the current working directory to the specified path.

GetCanonicalPath ( string path ) : string

Resolves a given path into an absolute path on the server.

RequestClose ( byte handle ) : void

Performs SSH_FXP_CLOSE request.

RequestFSetStat ( byte handle, SftpFileAttributes attributes ) : void

Performs SSH_FXP_FSETSTAT request.

RequestFStat ( byte handle ) : SftpFileAttributes

Performs SSH_FXP_FSTAT request.

RequestLStat ( string path ) : SftpFileAttributes

Performs SSH_FXP_LSTAT request.

RequestMkDir ( string path ) : void

Performs SSH_FXP_MKDIR request.

RequestOpen ( string path, Flags flags, bool nullOnError = false ) : byte[]

Performs SSH_FXP_OPEN request

RequestOpenDir ( string path, bool nullOnError = false ) : byte[]

Performs SSH_FXP_OPENDIR request

RequestPosixRename ( string oldPath, string newPath ) : void

Performs [email protected] extended request.

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

Performs SSH_FXP_READ request.

RequestReadDir ( byte handle ) : SftpFileAttributes>[].KeyValuePair

Performs SSH_FXP_READDIR request

RequestRemove ( string path ) : void

Performs SSH_FXP_REMOVE request.

RequestRename ( string oldPath, string newPath ) : void

Performs SSH_FXP_RENAME request.

RequestRmDir ( string path ) : void

Performs SSH_FXP_RMDIR request.

RequestSetStat ( string path, SftpFileAttributes attributes ) : void

Performs SSH_FXP_SETSTAT request.

RequestStatVfs ( string path, bool nullOnError = false ) : SftpFileSytemInformation

Performs [email protected] extended request.

RequestSymLink ( string linkpath, string targetpath ) : void

Performs SSH_FXP_SYMLINK request.

RequestWrite ( byte handle, ulong serverOffset, byte data, int offset, int length, AutoResetEvent wait, Action writeCompleted = null ) : void

Performs SSH_FXP_WRITE request.

SftpSession ( ISession session, System.TimeSpan operationTimeout, Encoding encoding ) : System

Protected Methods

Method Description
Dispose ( bool disposing ) : void
OnChannelOpen ( ) : void
OnDataReceived ( byte data ) : void

Private Methods

Method Description
GetFullRemotePath ( string path ) : string
GetSftpException ( SftpStatusResponse response ) : SshException
HandleResponse ( SftpResponse response ) : void
HardLink ( string oldPath, string newPath ) : void

Performs [email protected] extended request.

RequestFStatVfs ( byte handle, bool nullOnError = false ) : SftpFileSytemInformation

Performs [email protected] extended request.

RequestReadLink ( string path, bool nullOnError = false ) : SftpFileAttributes>[].KeyValuePair

Performs SSH_FXP_READLINK request.

RequestRealPath ( string path, bool nullOnError = false ) : SftpFileAttributes>[].KeyValuePair

Performs SSH_FXP_REALPATH request

RequestStat ( string path, bool nullOnError = false ) : SftpFileAttributes

Performs SSH_FXP_STAT request.

SendMessage ( SftpMessage sftpMessage ) : void
SendRequest ( SftpRequest request ) : void
TryLoadSftpMessage ( byte packetData, int offset, int count ) : bool

Method Details

CalculateOptimalReadLength() public method

Calculates the optimal size of the buffer to read data from the channel.
public CalculateOptimalReadLength ( uint bufferSize ) : uint
bufferSize uint The buffer size configured on the client.
return uint

CalculateOptimalWriteLength() public method

Calculates the optimal size of the buffer to write data on the channel.
Currently, we do not take the remote window size into account.
public CalculateOptimalWriteLength ( uint bufferSize, byte handle ) : uint
bufferSize uint The buffer size configured on the client.
handle byte The file handle.
return uint

ChangeDirectory() public method

Changes the current working directory to the specified path.
public ChangeDirectory ( string path ) : void
path string The new working directory.
return void

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

GetCanonicalPath() public method

Resolves a given path into an absolute path on the server.
public GetCanonicalPath ( string path ) : string
path string The path to resolve.
return string

OnChannelOpen() protected method

protected OnChannelOpen ( ) : void
return void

OnDataReceived() protected method

protected OnDataReceived ( byte data ) : void
data byte
return void

RequestClose() public method

Performs SSH_FXP_CLOSE request.
public RequestClose ( byte handle ) : void
handle byte The handle.
return void

RequestFSetStat() public method

Performs SSH_FXP_FSETSTAT request.
public RequestFSetStat ( byte handle, SftpFileAttributes attributes ) : void
handle byte The handle.
attributes SftpFileAttributes The attributes.
return void

RequestFStat() public method

Performs SSH_FXP_FSTAT request.
public RequestFStat ( byte handle ) : SftpFileAttributes
handle byte The handle.
return SftpFileAttributes

RequestLStat() public method

Performs SSH_FXP_LSTAT request.
public RequestLStat ( string path ) : SftpFileAttributes
path string The path.
return SftpFileAttributes

RequestMkDir() public method

Performs SSH_FXP_MKDIR request.
public RequestMkDir ( string path ) : void
path string The path.
return void

RequestOpen() public method

Performs SSH_FXP_OPEN request
public RequestOpen ( string path, Flags flags, bool nullOnError = false ) : byte[]
path string The path.
flags System.Flags The flags.
nullOnError bool if set to true returns null instead of throwing an exception.
return byte[]

RequestOpenDir() public method

Performs SSH_FXP_OPENDIR request
public RequestOpenDir ( string path, bool nullOnError = false ) : byte[]
path string The path.
nullOnError bool if set to true returns null instead of throwing an exception.
return byte[]

RequestPosixRename() public method

Performs [email protected] extended request.
public RequestPosixRename ( string oldPath, string newPath ) : void
oldPath string The old path.
newPath string The new path.
return void

RequestRead() public method

Performs SSH_FXP_READ request.
public RequestRead ( byte handle, ulong offset, uint length ) : byte[]
handle byte The handle.
offset ulong The offset.
length uint The length.
return byte[]

RequestReadDir() public method

Performs SSH_FXP_READDIR request
public RequestReadDir ( byte handle ) : SftpFileAttributes>[].KeyValuePair
handle byte The handle.
return SftpFileAttributes>[].KeyValuePair

RequestRemove() public method

Performs SSH_FXP_REMOVE request.
public RequestRemove ( string path ) : void
path string The path.
return void

RequestRename() public method

Performs SSH_FXP_RENAME request.
public RequestRename ( string oldPath, string newPath ) : void
oldPath string The old path.
newPath string The new path.
return void

RequestRmDir() public method

Performs SSH_FXP_RMDIR request.
public RequestRmDir ( string path ) : void
path string The path.
return void

RequestSetStat() public method

Performs SSH_FXP_SETSTAT request.
public RequestSetStat ( string path, SftpFileAttributes attributes ) : void
path string The path.
attributes SftpFileAttributes The attributes.
return void

RequestStatVfs() public method

Performs [email protected] extended request.
public RequestStatVfs ( string path, bool nullOnError = false ) : SftpFileSytemInformation
path string The path.
nullOnError bool if set to true [null on error].
return SftpFileSytemInformation

RequestSymLink() public method

Performs SSH_FXP_SYMLINK request.
public RequestSymLink ( string linkpath, string targetpath ) : void
linkpath string The linkpath.
targetpath string The targetpath.
return void

RequestWrite() public method

Performs SSH_FXP_WRITE request.
public RequestWrite ( byte handle, ulong serverOffset, byte data, int offset, int length, AutoResetEvent wait, Action writeCompleted = null ) : void
handle byte The handle.
serverOffset ulong The the zero-based offset (in bytes) relative to the beginning of the file that the write must start at.
data byte The buffer holding the data to write.
offset int the zero-based offset in at which to begin taking bytes to write.
length int The length (in bytes) of the data to write.
wait System.Threading.AutoResetEvent The wait event handle if needed.
writeCompleted Action The callback to invoke when the write has completed.
return void

SftpSession() public method

public SftpSession ( ISession session, System.TimeSpan operationTimeout, Encoding encoding ) : System
session ISession
operationTimeout System.TimeSpan
encoding System.Text.Encoding
return System