System.Net.FtpClient |
FtpClient Members |
FtpClient Class Constructors Methods Properties Events See Also Send Feedback |
The FtpClient type exposes the following members.
Constructors
Name | Description | |
---|---|---|
FtpClient |
Creates a new isntance of FtpClient
|
Methods
Name | Description | |
---|---|---|
Authenticate |
Performs a login on the server. This method is overridable so
that the login procedure can be changed to support, for example,
a FTP proxy.
|
|
BeginConnect |
Initiates a connection to the server
|
|
BeginCreateDirectory(String, AsyncCallback, Object) |
Creates a directory asynchronously
|
|
BeginCreateDirectory(String, Boolean, AsyncCallback, Object) |
Creates a directory asynchronously
|
|
BeginDeleteDirectory(String, AsyncCallback, Object) |
Asynchronously removes a directory from the server
|
|
BeginDeleteDirectory(String, Boolean, AsyncCallback, Object) |
Asynchronously removes a directory from the server
|
|
BeginDeleteDirectory(String, Boolean, FtpListOption, AsyncCallback, Object) |
Asynchronously removes a directory from the server
|
|
BeginDeleteFile |
Asynchronously deletes a file from the server
|
|
BeginDereferenceLink(FtpListItem, AsyncCallback, Object) |
Derefence a FtpListItem object asynchronously. See the
MaximumDereferenceCount property for controlling
how deep this method will recurse before giving up.
|
|
BeginDereferenceLink(FtpListItem, Int32, AsyncCallback, Object) |
Derefence a FtpListItem object asynchronously
|
|
BeginDirectoryExists |
Checks if a directory exists on the server asynchronously.
|
|
BeginDisconnect |
Initiates a disconnection on the server
|
|
BeginExecute |
Performs an asynchronouse execution of the specified command
|
|
BeginFileExists(String, AsyncCallback, Object) |
Checks if a file exsts on the server by taking a
file listing of the parent directory in the path
and comparing the results the path supplied.
|
|
BeginFileExists(String, FtpListOption, AsyncCallback, Object) |
Checks if a file exsts on the server by taking a
file listing of the parent directory in the path
and comparing the results the path supplied.
|
|
BeginGetFileSize |
Asynchronously retrieve the size of the specified file
|
|
BeginGetHash |
Asynchronously retrieves the hash for the specified file
|
|
BeginGetHashAlgorithm |
Asynchronously get the hash algorithm being used by the HASH command.
|
|
BeginGetListing(AsyncCallback, Object) |
Gets a file listing from the server asynchronously
|
|
BeginGetListing(String, AsyncCallback, Object) |
Gets a file listing from the server asynchronously
|
|
BeginGetListing(String, FtpListOption, AsyncCallback, Object) |
Gets a file listing from the server asynchronously
|
|
BeginGetModifiedTime |
Gets the modified time of the file
|
|
BeginGetNameListing(AsyncCallback, Object) |
Asynchronously gets a list of file and directory names for the specified path.
|
|
BeginGetNameListing(String, AsyncCallback, Object) |
Asynchronously gets a list of file and directory names for the specified path.
|
|
BeginGetWorkingDirectory |
Asynchronously retrieves the working directory
|
|
BeginOpenAppend(String, AsyncCallback, Object) |
Opens the specified file for writing
|
|
BeginOpenAppend(String, FtpDataType, AsyncCallback, Object) |
Opens the specified file for writing
|
|
BeginOpenRead(String, AsyncCallback, Object) |
Opens the specified file for reading
|
|
BeginOpenRead(String, Int64, AsyncCallback, Object) |
Opens the specified file for reading
|
|
BeginOpenRead(String, FtpDataType, AsyncCallback, Object) |
Opens the specified file for reading
|
|
BeginOpenRead(String, FtpDataType, Int64, AsyncCallback, Object) |
Opens the specified file for reading
|
|
BeginOpenWrite(String, AsyncCallback, Object) |
Opens the specified file for writing
|
|
BeginOpenWrite(String, FtpDataType, AsyncCallback, Object) |
Opens the specified file for writing
|
|
BeginRename |
Asynchronously renames an object on the server
|
|
BeginSetDataType |
Asynchronously sets the data type on the server
|
|
BeginSetHashAlgorithm |
Asynchronously sets the hash algorithm type to be used with the HASH command.
|
|
BeginSetWorkingDirectory |
Asynchronously changes the working directory on the server
|
|
Connect()()()() |
Connect to the server. Throws ObjectDisposedException if this object has been disposed.
|
|
Connect(Uri) |
Connects to the specified URI. If the path specified by the URI ends with a
/ then the working directory is changed to the path specified.
|
|
Connect(Uri, Boolean) |
Connects to the specified URI. If the path specified by the URI ends with a
/ then the working directory is changed to the path specified.
|
|
CreateDirectory(String) |
Creates a directory on the server. If the preceding
directories do not exist they are created.
|
|
CreateDirectory(String, Boolean) |
Creates a directory on the server
|
|
DeleteDirectory(String) |
Deletes the specified directory on the server.
|
|
DeleteDirectory(String, Boolean) |
Delets the specified directory on the server
|
|
DeleteDirectory(String, Boolean, FtpListOption) |
Deletes the specified directory on the server
|
|
DeleteFile |
Deletes a file on the server
|
|
DereferenceLink(FtpListItem) |
Recursively dereferences a symbolic link. See the
MaximumDereferenceCount property for controlling
how deep this method will recurse before giving up.
|
|
DereferenceLink(FtpListItem, Int32) |
Recursively dereferences a symbolic link
|
|
DirectoryExists |
Tests if the specified directory exists on the server. This
method works by trying to change the working directory to
the path specified. If it succeeds, the directory is changed
back to the old working directory and true is returned. False
is returned otherwise and since the CWD failed it is assumed
the working directory is still the same.
|
|
DisableUTF8 |
Disables UTF8 support and changes the Encoding property
back to ASCII. If the server returns an error when trying
to turn UTF8 off a FtpCommandException will be thrown.
|
|
Disconnect |
Disconnect from the server
|
|
Dispose |
Disconnects from the server, releases resources held by this
object.
|
|
EndConnect |
Ends an asynchronous connection attempt to the server
|
|
EndCreateDirectory |
Ends a call to BeginCreateDirectory
|
|
EndDeleteDirectory |
Ends a call to BeginDeleteDirectory()
|
|
EndDeleteFile |
Ends a call to BeginDeleteFile
|
|
EndDereferenceLink |
Ends a call to BeginDereferenceLink
|
|
EndDirectoryExists |
Ends a call to BeginDirectoryExists
|
|
EndDisconnect |
Ends a call to BeginDisconnect
|
|
EndExecute |
Ends an asynchronous command
|
|
EndFileExists |
Ends a call to BeginFileExists
|
|
EndGetFileSize |
Ends a call to BeginGetFileSize()
|
|
EndGetHash |
Ends an asynchronous call to BeginGetHash
|
|
EndGetHashAlgorithm |
Ends a call to BeginGetHashAlgorithm
|
|
EndGetListing |
Ends an asynchronous file listing
|
|
EndGetModifiedTime |
Ends a call to BeginGetModifiedTime()
|
|
EndGetNameListing |
Ends a call to BeginGetNameListing()
|
|
EndGetWorkingDirectory |
Ends an asynchronous call to retrieve the working directory
|
|
EndOpenAppend |
Ends a call to BeginOpenAppend()
|
|
EndOpenRead |
Ends a call to BeginOpenRead()
|
|
EndOpenWrite |
Ends a call to BeginOpenWrite()
|
|
EndRename |
Ends a call to BeginRename
|
|
EndSetDataType |
Ends a call to BeginSetDataType()
|
|
EndSetHashAlgorithm |
Ends an asynchronous call to BeginSetHashAlgorithm
|
|
EndSetWorkingDirectory |
Ends asynchronous directory change
|
|
Equals | (Inherited from Object.) | |
Execute(String) |
Executes a command
|
|
Execute(String, array<Object>[]()[][]) |
Executes a command
|
|
FileExists(String) |
Checks if a file exsts on the server by taking a
file listing of the parent directory in the path
and comparing the results the path supplied.
|
|
FileExists(String, FtpListOption) |
Checks if a file exsts on the server by taking a
file listing of the parent directory in the path
and comparing the results the path supplied.
|
|
Finalize |
Finalizer
(Overrides Object..::..Finalize()()()().) |
|
GetAsyncDelegate<(Of <<'(T>)>>) |
Retretieves the delegate for the specified IAsyncResult and removes
it from the m_asyncmethods collection if the operation is successfull
|
|
GetFeatures |
Populates the capabilities flags based on capabilities
supported by this server. This method is overridable
so that new features can be supported
|
|
GetFileSize |
Gets the size of the file
|
|
GetHash |
Gets the hash of an object on the server using the
currently selected hash algorithm. Supported
algorithms, if any, are available in the HashAlgorithms
property. You should confirm that it's not equal
to FtpHashAlgorithm.NONE before calling this method
otherwise the server trigger a FtpCommandException()
due to a lack of support for the HASH command. You can
set the algorithm using the SetHashAlgorithm() method and
you can query the server for the current hash algorithm
using the GetHashAlgorithm() method.
This feature is experimental and based on the following draft:
http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
|
|
GetHashAlgorithm |
Gets the currently selected hash algorith for the HASH
command. This feature is experimental. See this link
for details:
http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
|
|
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
|
GetListing()()()() |
Gets a file listing from the server. Each FtpListItem object returned
contains information about the file that was able to be retrieved. If
a DateTime property is equal to DateTime.MinValue then it means the
date in question was not able to be retrieved. If the Size property
is equal to 0 then it means the size of the object could also not
be retrieved.
|
|
GetListing(String) |
Gets a file listing from the server. Each FtpListItem object returned
contains information about the file that was able to be retrieved. If
a DateTime property is equal to DateTime.MinValue then it means the
date in question was not able to be retrieved. If the Size property
is equal to 0 then it means the size of the object could also not
be retrieved.
|
|
GetListing(String, FtpListOption) |
Gets a file listing from the server. Each FtpListItem object returned
contains information about the file that was able to be retrieved. If
a DateTime property is equal to DateTime.MinValue then it means the
date in question was not able to be retrieved. If the Size property
is equal to 0 then it means the size of the object could also not
be retrieved.
|
|
GetModifiedTime |
Gets the modified time of the file
|
|
GetNameListing()()()() |
Returns a file/directory listing using the NLST command.
|
|
GetNameListing(String) |
Returns a file/directory listing using the NLST command.
|
|
GetType | Gets the Type of the current instance. (Inherited from Object.) |
|
GetWorkingDirectory |
Gets the current working directory
|
|
HasFeature |
Performs a bitwise and to check if the specified
flag is set on the Capabilities enum property.
|
|
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
|
OpenAppend(String) |
Opens the specified file to be appended to
|
|
OpenAppend(Uri) |
Opens a stream to the file specified by the URI
|
|
OpenAppend(String, FtpDataType) |
Opens the specified file to be appended to
|
|
OpenAppend(Uri, Boolean) |
Opens a stream to the file specified by the URI
|
|
OpenAppend(Uri, Boolean, FtpDataType) |
Opens a stream to the file specified by the URI
|
|
OpenRead(String) |
Opens the specified file for reading
|
|
OpenRead(Uri) |
Opens a stream to the file specified by the URI
|
|
OpenRead(String, Int64) |
Opens the specified file for reading
|
|
OpenRead(String, FtpDataType) |
Opens the specified file for reading
|
|
OpenRead(Uri, Boolean) |
Opens a stream to the file specified by the URI
|
|
OpenRead(String, FtpDataType, Int64) |
Opens the specified file for reading
|
|
OpenRead(Uri, Boolean, FtpDataType) |
Opens a stream to the file specified by the URI
|
|
OpenRead(Uri, Boolean, FtpDataType, Int64) |
Opens a stream to the file specified by the URI
|
|
OpenWrite(String) |
Opens the specified file for writing
|
|
OpenWrite(Uri) |
Opens a stream to the file specified by the URI
|
|
OpenWrite(String, FtpDataType) |
Opens the specified file for writing
|
|
OpenWrite(Uri, Boolean) |
Opens a stream to the file specified by the URI
|
|
OpenWrite(Uri, Boolean, FtpDataType) |
Opens a stream to the file specified by the URI
|
|
Rename |
Renames an object on the remote file system.
|
|
SetDataType |
Sets the data type of information sent over the data stream
|
|
SetHashAlgorithm |
Tells the server which hash algorith to use
for the HASH command. If you specifiy an
algorithm not listed in FtpClient.HashTypes
a NotImplemented() exectpion will be thrown
so be sure to query that list of Flags before
selecting a hash algorithm. Support for the
HASH command is experimental. Please see
the following link for more details:
http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
|
|
SetWorkingDirectory |
Sets the work directory on the server
|
|
ToString | (Inherited from Object.) |
Extension Methods
Name | Description | |
---|---|---|
BeginGetChecksum |
Asynchronusly retrieve a checksum of the specified file. This feature
is non-standard.
(Defined by ChecksumExtension.) |
|
BeginGetMD5 |
Asynchronusly retrieve a MD5 hash. The MD5 command is non-standard
and not guaranteed to work.
(Defined by MD5.) |
|
BeginGetXCRC |
Asynchronusly retrieve a CRC hash. The XCRC command is non-standard
and not guaranteed to work.
(Defined by XCRC.) |
|
BeginGetXMD5 |
Asynchronusly retrieve a MD5 hash. The XMD5 command is non-standard
and not guaranteed to work.
(Defined by XMD5.) |
|
BeginGetXSHA1 |
Asynchronusly retrieve a SHA1 hash. The XSHA1 command is non-standard
and not guaranteed to work.
(Defined by XSHA1.) |
|
BeginGetXSHA256 |
Asynchronusly retrieve a SHA256 hash. The XSHA256 command is non-standard
and not guaranteed to work.
(Defined by XSHA256.) |
|
BeginGetXSHA512 |
Asynchronusly retrieve a SHA512 hash. The XSHA512 command is non-standard
and not guaranteed to work.
(Defined by XSHA512.) |
|
GetChecksum |
Retrieves a checksum of the given file using a checksumming method
that the server supports, if any. The algorithm used goes in this order:
1. HASH command; server preferred algorithm. See FtpClient.SetHashAlgorithm()
2. MD5 / XMD5 commands
3. XSHA1 command
4. XSHA256 command
5. XSHA512 command
6. XCRC command
(Defined by ChecksumExtension.) |
|
GetMD5 |
Gets the MD5 hash of the specified file using MD5. This is a non-standard extension
to the protocol and may or may not work. A FtpCommandException will be
thrown if the command fails.
(Defined by MD5.) |
|
GetXCRC |
Get the CRC value of the specified file. This is a non-standard extension of the protocol
and may throw a FtpCommandException if the server does not support it.
(Defined by XCRC.) |
|
GetXMD5 |
Gets the MD5 hash of the specified file using XMD5. This is a non-standard extension
to the protocol and may or may not work. A FtpCommandException will be
thrown if the command fails.
(Defined by XMD5.) |
|
GetXSHA1 |
Gets the SHA-1 hash of the specified file using XSHA1. This is a non-standard extension
to the protocol and may or may not work. A FtpCommandException will be
thrown if the command fails.
(Defined by XSHA1.) |
|
GetXSHA256 |
Gets the SHA-256 hash of the specified file using XSHA256. This is a non-standard extension
to the protocol and may or may not work. A FtpCommandException will be
thrown if the command fails.
(Defined by XSHA256.) |
|
GetXSHA512 |
Gets the SHA-512 hash of the specified file using XSHA512. This is a non-standard extension
to the protocol and may or may not work. A FtpCommandException will be
thrown if the command fails.
(Defined by XSHA512.) |
Properties
Name | Description | |
---|---|---|
BaseStream |
Gets the base stream for talking to the server via
the control connection.
|
|
Capabilities |
Gets the server capabilties represented by flags
|
|
ClientCertificates |
Client certificates to be used in SSL authentication process
|
|
ConnectTimeout |
Gets or sets the length of time in miliseconds to wait for a connection
attempt to succeed before giving up. Default is 15000 (15 seconds).
|
|
Credentials |
Credentials used for authentication
|
|
DataConnectionConnectTimeout |
Gets or sets the length of time in miliseconds for a data connection
to be established before giving up. Default is 15000 (15 seconds).
|
|
DataConnectionEncryption |
Indicates if data channel transfers should be encrypted. Only valid if EncryptionMode
property is not equal to FtpSslMode.None.
|
|
DataConnectionReadTimeout |
Gets or sets the length of time in miliseconds the data channel
should wait for the server to send data. Default value is
15000 (15 seconds).
|
|
DataConnectionType |
Data connection type, default is AutoPassive which tries
a connection with EPSV first and if it fails then tries
PASV before giving up. If you know exactly which kind of
connection you need you can slightly increase performance
by defining a speicific type of passive or active data
connection here.
|
|
EnableThreadSafeDataConnections |
When this value is set to true (default) the control connection
is cloned and a new connection the server is established for the
data channel operation. This is a thread safe approach to make
asynchronous operations on a single control connection transparent
to the developer.
|
|
Encoding |
Gets the text encoding being used when talking with the server. The default
value is Encoding.ASCII however upon connection, the client checks
for UTF8 support and if it's there this property is switched over to
Encoding.UTF8.
|
|
EncryptionMode |
Type of SSL to use, or none. Default is none. Explicit is TLS, Implicit is SSL.
|
|
HashAlgorithms |
Get the hash types supported by the server, if any. This
is a recent extension to the protocol that is not fully
standardized and is not guarateed to work. See here for
more details:
http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
|
|
Host |
The server to connect to
|
|
InternetProtocolVersions |
Flags specifying which versions of the internet protocol to
support when making a connection. All addresses returned during
name resolution are tried until a successful connection is made.
You can fine tune which versions of the internet protocol to use
by adding or removing flags here. I.e., setting this property
to FtpIpVersion.IPv4 will cause the connection process to
ignore IPv6 addresses. The default value is ANY version.
|
|
IsConnected |
Gets a value indicating if the connection is alive
|
|
IsDisposed |
Gets a value indicating if this object has already been disposed.
|
|
MaximumDereferenceCount |
Gets or sets a value that controls the maximum depth
of recursion that DereferenceLink() will follow symbolic
links before giving up. You can also specify the value
to be used as one of the overloaded parameters to the
DereferenceLink() method. The default value is 20. Specifying
-1 here means inifinitly try to resolve a link. This is
not recommended for obvious reasons (stack overflow).
|
|
Port |
The port to connect to. If this value is set to 0 (Default) the port used
will be determined by the type of SSL used or if no SSL is to be used it
will automatically connect to port 21.
|
|
ReadTimeout |
Gets or sets the length of time wait in miliseconds for data to be
read from the underlying stream. The default value is 15000 (15 seconds).
|
|
SocketKeepAlive |
Gets or sets a value indicating if SocketOption.KeepAlive should be set on
the underlying stream's socket. If the connection is alive, the option is
adjusted in real-time. The value is stored and the KeepAlive option is set
accordingly upon any new connections. The value set here is also applied to
all future data streams. It has no affect on cloned control connections or
data connections already in progress. The default value is false.
|
|
SocketPollInterval |
Gets or sets the length of time in miliseconds
that must pass since the last socket activity
before calling Poll() on the socket to test for
connectivity. Setting this interval too low will
have a negative impact on perfomance. Setting this
interval to 0 disables Poll()'ing all together.
The default value is 15 seconds.
|
|
SystemType |
Gets the type of system/server that we're
connected to.
|
|
UngracefullDisconnection |
Disconnect from the server without sending QUIT. This helps
work around IOExceptions caused by buggy connection resets
when closing the control connection.
|
Events
Name | Description | |
---|---|---|
ValidateCertificate |
Event is fired to validate SSL certificates. If this event is
not handled and there are errors validating the certificate
the connection will be aborted.
|