Sftp Class
Namespace: Rebex.Net
Assembly: Rebex.Sftp.dll (version 7.0.9147)
Provides methods for communication with SFTP servers.
Syntax
public class Sftp : NetworkSession, ILogWriterProvider, IFtp, IDisposable
Inherited Members
Remarks
All members of this class are thread-safe.
Constructors
Name | Description |
---|---|
Sftp() | Initializes a new instance of the Sftp class. |
Fields
Name | Description |
---|---|
Default |
Default SFTP port (22). |
Properties
Name | Description |
---|---|
Default |
Gets or sets a default log writer used by all new instances of Network |
Encoding | Gets or sets the Encoding to use to encode and decode command parameters and server responses. |
Fingerprint | Gets the server public key fingerprint (a SHA-256 hash of the server public key). |
Instance |
Gets instance ID (intended for logging purposes).
Inherited from Network |
Is |
Gets a value indicating whether the session is authenticated. |
Is |
Gets a value indicating whether the session is connected. |
Local |
Gets the local client End |
Log |
Gets or sets the Log |
Max |
Gets or sets the maximum allowed download speed, in kilobytes per second. For unlimited speed, set this to zero. |
Max |
Gets or sets the maximum allowed upload speed, in kilobytes per second. For unlimited speed, set this to zero. |
Protocol |
Gets the SFTP protocol version used by this session. This information is only available on fully initialized and authenticated sessions. |
Proxy | Gets or sets the network proxy to use to access a remote server. |
Remote |
Gets the remote server End |
Server |
Gets the server public key. |
Server |
Gets the server name, if available.
Inherited from Network |
Server |
Gets the server port, if available.
Inherited from Network |
Server |
Gets or sets the server type. |
Session | Gets the SSH session used by this SFTP session. |
Settings | Gets or sets SFTP object settings. |
Timeout | Gets or sets the length of time in milliseconds before the operation times out (specify -1 or 0 to indicate that the request does not time out). |
Transfer |
Gets or sets the data transfer type. Make sure to set the Server |
User |
Gets the authenticated user name, if available.
Inherited from Network |
Version | Gets the version of the SFTP component. |
Methods
Name | Description |
---|---|
Abort |
Aborts all pending file transfers (either file transfer or directory listing). |
Abort |
Aborts pending transfers (either file transfer or directory listing) identified by the specified user-provided state object. |
Bind(ISocket) | Binds the Sftp object to an underlying stream socket. This method is experimental and intended for advanced users. |
Bind(Ssh |
Binds the Sftp object to an underlying SSH session. This makes it possible to run multiple SFTP sessions over a single SSH session. This can be used instead of Connect(String)/Login(String, String) methods. |
Bind |
Begins asynchronous Bind operation. Binds the Sftp object to an underlying SSH session. This makes it possible to run multiple SFTP sessions over a single SSH session. This can be used instead of Connect(String)/Login(String, String) methods. |
Change |
Changes the current working directory on the server. |
Change |
Begins asynchronous ChangeDirectory operation. Changes the current working directory on the server. |
Check |
Checks whether the SFTP session is still connected. Throws an exception on error. |
Connect(String) | Connects to the SFTP server. |
Connect(String, Int32) | Connects to the SFTP server. |
Connect |
Begins asynchronous Connect operation. Connects to the SFTP server. |
Connect |
Begins asynchronous Connect operation. Connects to the SFTP server. |
Create |
Creates a directory on the server. |
Create |
Begins asynchronous CreateDirectory operation. Creates a directory on the server. |
Create |
Creates a symbolic link or hard link on the server. |
Create |
Begins asynchronous CreateLink operation. Creates a symbolic link or hard link on the server. |
Create |
Creates a symbolic link on the server. |
Create |
Begins asynchronous CreateSymlink operation. Creates a symbolic link on the server. |
Delete(File |
Deletes specified files and/or directories on the server. |
Delete(String, Traversal |
Deletes specified files and/or directories on the server. Accepts wildcards. |
Delete |
Begins asynchronous Delete operation. Deletes specified files and/or directories on the server. |
Delete |
Begins asynchronous Delete operation. Deletes specified files and/or directories on the server. Accepts wildcards. |
Delete |
Deletes a file on the server. |
Delete |
Begins asynchronous DeleteFile operation. Deletes a file on the server. |
Directory |
Detects whether the specified directory exists on the server. |
Directory |
Begins asynchronous DirectoryExists operation. Detects whether the specified directory exists on the server. |
Disconnect() | Informs the server that the connection is about to close and terminates the connection. |
Disconnect |
Begins asynchronous Disconnect operation. Informs the server that the connection is about to close and terminates the connection. |
Dispose() | Disposes the Sftp object and the underlying SSH object. |
Dispose(Boolean) | Releases the unmanaged resources used by the Sftp and optionally releases the managed resources. |
Download(File |
Downloads the specified files and/or directories from the SFTP server to the local directory. |
Download(File |
Downloads the specified files and/or directories from the SFTP server to the local directory. |
Download(String, String) | Downloads the specified file or directory hierarchy from the SFTP server to the local directory. Accepts wildcards. |
Download(String, String, Traversal |
Downloads the specified file or directory hierarchy from the SFTP server to the local directory. Accepts wildcards. |
Download(String, String, Traversal |
Downloads the specified file or directory hierarchy from the SFTP server to the local directory. Accepts wildcards. |
Download |
Begins asynchronous Download operation. Downloads the specified files and/or directories from the SFTP server to the local directory. |
Download |
Begins asynchronous Download operation. Downloads the specified file or directory hierarchy from the SFTP server to the local directory. Accepts wildcards. |
File |
Detects whether the specified file exists on the server. |
File |
Begins asynchronous FileExists operation. Detects whether the specified file exists on the server. |
Finalize() | Finalizer. Called by garbage collector during object destruction. |
Get |
Returns the checksum of the specified file on the server. Only works on servers that support the extension.
|
Get |
Returns the checksum of the specified file on the server. Only works on servers that support the extension.
|
Get |
Begins asynchronous GetChecksum operation. Returns the checksum of the specified file on the server. Only works on servers that support the extension.
|
Get |
Begins asynchronous GetChecksum operation. Returns the checksum of the specified file on the server. Only works on servers that support the extension.
|
Get |
Checks whether the SFTP session is still connected and returns its state. |
Get |
Gets the absolute path of the current working directory on the remote server. |
Get |
Returns a Stream for reading data from the remote file. |
Get |
Downloads the remote file to the data stream. |
Get |
Downloads the specified part of the remote file to the data stream. |
Get |
Downloads the remote file to the local file, overriding it if it already exists. |
Get |
Downloads the specified part of the remote file to the specified offset of the local file. |
Get |
Begins asynchronous GetFile operation. Downloads the specified part of the remote file to the data stream. |
Get |
Begins asynchronous GetFile operation. Downloads the remote file to the data stream. |
Get |
Begins asynchronous GetFile operation. Downloads the specified part of the remote file to the specified offset of the local file. |
Get |
Begins asynchronous GetFile operation. Downloads the remote file to the local file, overriding it if it already exists. |
Get |
Retrieves the modification date and time of the specified remote file. |
Get |
Begins asynchronous GetFileDateTime operation. Retrieves the modification date and time of the specified remote file. |
Get |
Retrieves the size of the specified remote file. |
Get |
Begins asynchronous GetFileLength operation. Retrieves the size of the specified remote file. |
Get |
Gets drive information (such as free disk space) for the specified path. |
Get |
Begins asynchronous GetFileSystemInfo operation. Gets drive information (such as free disk space) for the specified path. |
Get |
Gets hash code for this object.
Inherited from Network |
Get |
Gets the absolute path of the home directory path of currently logged user. |
Get |
Retrieves a Sftp |
Get |
Retrieves a Sftp |
Get |
Begins asynchronous GetInfo operation.
Retrieves a Sftp |
Get |
Retrieves the list of files and directories specified by the |
Get |
Retrieves the list of files and directories. Matching directories are searched recursively. |
Get |
Retrieves the list of files and directories. |
Get |
Begins asynchronous GetItems operation.
Retrieves the list of files and directories specified by the |
Get |
Begins asynchronous GetItems operation. Retrieves the list of files and directories. |
Get |
Retrieves the list of files and directories in the current remote directory. |
Get |
Retrieves the list of files and directories in the specified remote directory, or a list of files matching the specified mask. |
Get |
Begins asynchronous GetList operation. Retrieves the list of files and directories in the current remote directory. |
Get |
Begins asynchronous GetList operation. Retrieves the list of files and directories in the specified remote directory, or a list of files matching the specified mask. |
Get |
Retrieves the list of file and directory names in the current remote directory. |
Get |
Retrieves the list of file and directory names in the specified remote directory, or a list of names matching the specified mask. |
Get |
Begins asynchronous GetNameList operation. Retrieves the list of file and directory names in the current remote directory. |
Get |
Begins asynchronous GetNameList operation. Retrieves the list of file and directory names in the specified remote directory, or a list of names matching the specified mask. |
Get |
Retrieves the list of files and directories in the current remote directory using a raw text format. |
Get |
Retrieves the list of files and directories in the specified remote directory (or a list of files matching the specified mask) using a raw text format. |
Get |
Begins asynchronous GetRawList operation. Retrieves the list of files and directories in the current remote directory using a raw text format. |
Get |
Begins asynchronous GetRawList operation. Retrieves the list of files and directories in the specified remote directory (or a list of files matching the specified mask) using a raw text format. |
Get |
Returns a Stream for reading and writing data from the remote file. |
Get |
Returns a Stream for reading data from the remote file. |
Get |
Begins asynchronous GetStream operation. Returns a Stream for reading data from the remote file. |
Get |
Returns a Stream for writing data to the remote file.
The remote file is created if it doesn't exist, and truncated if it does.
Use Get |
Keep |
Sends an SSH 'ignore' packet to the server. This can be used to keep firewalls or routers that don't like inactive connection from closing idle session. |
Keep |
Begins asynchronous KeepAlive operation. Sends an SSH 'ignore' packet to the server. This can be used to keep firewalls or routers that don't like inactive connection from closing idle session. |
Login() | Authenticates the user to the server interactively and initializes the SFTP session.
Uses Authentication |
Login(Ssh |
Authenticates to the server using GSSAPI. Kerberos is only supported on Mono. NTLM is supported on Windows and partially on Mono. |
Login(String) | Authenticates the user to the server interactively and initializes the SFTP session.
Uses Authentication |
Login(String, Ssh |
Authenticates the user to the server using his private key and initializes the SFTP session. |
Login(String, Ssh |
Authenticates the user to the server using his private key and initializes the SFTP session. |
Login(String, String) | Authenticates the user to the server and initializes the SFTP session. |
Login(String, String, Ssh |
Authenticates the user to the server using a combination of password and public key and initializes the SFTP session. |
Login(String, String, Ssh |
Authenticates the user to the server using a combination of password and public key and initializes the SFTP session. |
Login |
Begins asynchronous Login operation. Authenticates to the server using GSSAPI. Kerberos is only supported on Mono. NTLM is supported on Windows and partially on Mono. |
Login |
Begins asynchronous Login operation.
Authenticates the user to the server interactively and initializes the SFTP session.
Uses Authentication |
Login |
Begins asynchronous Login operation. Authenticates the user to the server using his private key and initializes the SFTP session. |
Login |
Begins asynchronous Login operation. Authenticates the user to the server using his private key and initializes the SFTP session. |
Login |
Begins asynchronous Login operation.
Authenticates the user to the server interactively and initializes the SFTP session.
Uses Authentication |
Login |
Begins asynchronous Login operation. Authenticates the user to the server using a combination of password and public key and initializes the SFTP session. |
Login |
Begins asynchronous Login operation. Authenticates the user to the server using a combination of password and public key and initializes the SFTP session. |
Login |
Begins asynchronous Login operation. Authenticates the user to the server and initializes the SFTP session. |
On |
Raises the Command |
On |
Raises the Response |
On |
Raises the Rebex. |
On |
Raises the Rebex. |
Put |
Uploads the content of the data stream to the file on the server, overriding it if it already exists. |
Put |
Uploads the content of the data stream to the specified offset of the file on the SFTP server. |
Put |
Uploads the content of the local file to the file on the server, overriding it if it already exists. |
Put |
Uploads the specified part of the local file to the specified offset of the file on the SFTP server. |
Put |
Begins asynchronous PutFile operation. Uploads the content of the data stream to the specified offset of the file on the SFTP server. |
Put |
Begins asynchronous PutFile operation. Uploads the content of the data stream to the file on the server, overriding it if it already exists. |
Put |
Begins asynchronous PutFile operation. Uploads the specified part of the local file to the specified offset of the file on the SFTP server. |
Put |
Begins asynchronous PutFile operation. Uploads the content of the local file to the file on the server, overriding it if it already exists. |
Remove |
Deletes an empty remote directory with the specified pathname. |
Remove |
Begins asynchronous RemoveDirectory operation. Deletes an empty remote directory with the specified pathname. |
Rename(String, String) | Renames or moves a file or directory on the server. |
Rename |
Begins asynchronous Rename operation. Renames or moves a file or directory on the server. |
Resolve |
Canonicalizes the specified remote path to an absolute path. Returns null if the specified path does not exist. |
Resolve |
Begins asynchronous ResolvePath operation. Canonicalizes the specified remote path to an absolute path. Returns null if the specified path does not exist. |
Resolve |
Resolves the symlink and returns the real path. |
Resolve |
Begins asynchronous ResolveSymlink operation. Resolves the symlink and returns the real path. |
Set |
Sets the attributes of the remote file. |
Set |
Begins asynchronous SetAttributes operation. Sets the attributes of the remote file. |
Set |
Sets the modification date and time of the specified remote file. |
Set |
Begins asynchronous SetFileDateTime operation. Sets the modification date and time of the specified remote file. |
Set |
Sets the socket factory to be used to create communication sockets. |
To |
Returns a string representation of this object. |
Upload(File |
Uploads the specified local files and/or directories to the directory to the SFTP server. |
Upload(File |
Uploads the specified local files and/or directories to the directory to the SFTP server. |
Upload(String, String) | Uploads the specific local file or directory hierarchy to the directory to the SFTP server. Accepts wildcards. |
Upload(String, String, Traversal |
Uploads the specific local file or directory hierarchy to the directory to the SFTP server. Accepts wildcards. |
Upload(String, String, Traversal |
Uploads the specified local file or directory hierarchy to the directory to the SFTP server. Accepts wildcards. |
Upload |
Begins asynchronous Upload operation. Uploads the specified local files and/or directories to the directory to the SFTP server. |
Upload |
Begins asynchronous Upload operation. Uploads the specified local file or directory hierarchy to the directory to the SFTP server. Accepts wildcards. |
Events
Name | Description |
---|---|
Authentication |
Occurs when an authentication request is received from the server that cannot be answered programmatically. |
Banner |
Occurs when a banner message is received from the server. |
Command |
Occurs when a command is send to the server. |
Delete |
Occurs when a significant action occurs in Delete method. Notifies the client about currently processing directory, currently deleting file and progress of the delete. |
Fingerprint |
Occurs when a fingerprint is received from the server and needs to be validated. |
List |
Occurs when a file and directory listing item is received by Get |
Problem |
Occurs when a problem is detected in Download, Upload, Delete or Get |
Response |
Occurs when a response is received from the server. |
Transfer |
Occurs when a significant action occurs in Download, Upload methods. Notifies the client about currently processing directory, currently transferring file and progress of the transfer. |
Traversing | Occurs when a significant action occurs in Download, Upload, Delete or Get |
Explicit Interface Implementations
Name | Description |
---|---|
IFtp. |
Abort pending operations. |
IFtp. |
Occurs when a significant action occurs in Delete(String, Traversal |
IFtp. |
Gets the absolute path of the current working directory on the remote server. |
IFtp. |
Returns a Stream for reading data from the remote file. |
IFtp. |
Returns a Stream for reading data from the remote file. |
IFtp. |
Downloads the specified part of the remote file to the data stream. |
IFtp. |
Downloads the specified part of the remote file to the specified offset of the local file. |
IFtp. |
Downloads the specified part of the remote file to the data stream. |
IFtp. |
Downloads the specified part of the remote file to the specified offset of the local file. |
IFtp. |
Retrieves a File |
IFtp. |
Retrieves a File |
IFtp. |
Retrieves the list of files and directories specified by the |
IFtp. |
Retrieves the list of files and directories. Matching directories are searched recursively. |
IFtp. |
Retrieves the list of files and directories. |
IFtp. |
Retrieves the list of files and directories specified by the |
IFtp. |
Retrieves the list of files and directories. |
IFtp. |
Retrieves the list of files and directories in the current server directory. |
IFtp. |
Retrieves the list of files and directories in the current server directory. |
IFtp. |
Retrieves the list of files and directories in the current server directory. |
IFtp. |
Retrieves the list of files and directories in the current server directory. |
IFtp. |
Returns a Stream for writing data to the remote file. |
IFtp. |
Returns a Stream for writing data to the remote file. |
IFtp. |
Sends a command to the server to keep the connection alive. |
IFtp. |
Occurs when a file and directory listing item is received by the Get |
IFtp. |
Occurs when a problem is detected in Download(String, String), Upload(String, String), Delete(String, Traversal |
IFtp. |
Gets the options set used by this object. |
IFtp. |
Occurs when a significant action occurs in Download(String, String), Upload(String, String) methods. Notifies the client about currently processing directory, currently transferring file and progress of the transfer. |
IFtp. |
Gets or sets the data transfer type. |
IFtp. |
Occurs when a significant action occurs in Download(String, String), Upload(String, String), Delete(String, Traversal |