System.Net.FtpClient
Retrieve checksum of file on the server
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
FtpClient Object
Full or relative path of the file to checksum
FtpHash object containing the value and algorithm. Use the IsValid property to
determine if this command was successfull. FtpCommandException's can be thrown from
the underlying calls.
Asynchronusly retrieve a checksum of the specified file. This feature
is non-standard.
FtpClient Object
Full or relative path to remote file
AsyncCallback
State Object
IAsyncResult
Ends an asynchronous call to BeginGetChecksum()
IAsyncResult returned from BeginGetChecksum()
FtpHash object containing the value and algorithm. Use the IsValid property to
determine if this command was successfull. FtpCommandException's can be thrown from
the underlying calls.
Implementation of the non-standard MD5 command
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.
FtpClient Object
Full or relative path to remote file
Server response, presumably the MD5 hash.
Asynchronusly retrieve a MD5 hash. The MD5 command is non-standard
and not guaranteed to work.
FtpClient Object
Full or relative path to remote file
AsyncCallback
State Object
IAsyncResult
Ends an asynchronous call to BeginGetMD5()
IAsyncResult returned from BeginGetMD5()
The MD5 hash of the specified file.
Event is fired when a ssl certificate needs to be validated
The contol connection that triggered the event
Event args
FTP Control Connection. Speaks the FTP protocol with the server and
provides facilities for performing basic transactions.
Debugging problems with FTP transactions is much easier to do when
you can see exactly what is sent to the server and the reply
System.Net.FtpClient gets in return. Please review the Debug example
below for information on how to add TraceListeners for capturing
the convorsation between System.Net.FtpClient and the server.
The following example illustrates how to assist in debugging
System.Net.FtpClient by getting a transaction log from the server.
The following example demonstrates adding a custom file
listing parser in the event that you encounter a list format
not already supported.
The following example demonstrates how to validate
a SSL certificate when using SSL/TLS.
The following example demonsrates how to download a file.
The following example demonstrates how to download a file
using a URI object.
The following example demonstrates how to upload a file.
The following example demonstrates how to upload a file
using a URI object.
The following example demonstrates how to append to a file.
The following example demonstrates how to append to a file
using a URI object.
The following example demonstrates how to get a file
listing from the server.
FTP Control Connection. Speaks the FTP protocol with the server and
provides facilities for performing basic transactions.
Debugging problems with FTP transactions is much easier to do when
you can see exactly what is sent to the server and the reply
System.Net.FtpClient gets in return. Please review the Debug example
below for information on how to add TraceListeners for capturing
the convorsation between System.Net.FtpClient and the server.
The following example illustrates how to assist in debugging
System.Net.FtpClient by getting a transaction log from the server.
The following example demonstrates adding a custom file
listing parser in the event that you encounter a list format
not already supported.
The following example demonstrates how to validate
a SSL certificate when using SSL/TLS.
The following example demonsrates how to download a file.
The following example demonstrates how to download a file
using a URI object.
The following example demonstrates how to upload a file.
The following example demonstrates how to upload a file
using a URI object.
The following example demonstrates how to append to a file.
The following example demonstrates how to append to a file
using a URI object.
The following example demonstrates how to get a file
listing from the server.
Performs a bitwise and to check if the specified
flag is set on the Capabilities enum property.
The capability to check for
True if the feature was found
Executes a command
The command to execute with optional format place holders
Format parameters to the command
The servers reply to the command
Executes a command
The command to execute
The servers reply to the command
Performs an asynchronouse execution of the specified command
The command to execute
The AsyncCallback method
State object
IAsyncResult
Ends an asynchronous command
IAsyncResult returned from BeginExecute
FtpReply object (never null).
Connect to the server. Throws ObjectDisposedException if this object has been disposed.
Initiates a connection to the server
AsyncCallback method
State object
IAsyncResult
Ends an asynchronous connection attempt to the server
IAsyncResult returned from BeginConnect()
Disconnect from the server
Initiates a disconnection on the server
AsyncCallback method
State object
IAsyncResult
Ends a call to BeginDisconnect
IAsyncResult returned from BeginDisconnect
Opens the specified file for reading
The full or relative path of the file
A stream for reading the file on the server
Opens the specified file for reading
The full or relative path of the file
ASCII/Binary
A stream for reading the file on the server
Opens the specified file for reading
The full or relative path of the file
Resume location
A stream for reading the file on the server
Opens the specified file for reading
The full or relative path of the file
ASCII/Binary
Resume location
A stream for reading the file on the server
Opens the specified file for reading
The full or relative path of the file
Async Callback
State object
IAsyncResult
Opens the specified file for reading
The full or relative path of the file
ASCII/Binary
Async Callback
State object
IAsyncResult
Opens the specified file for reading
The full or relative path of the file
Resume location
Async Callback
State object
IAsyncResult
Opens the specified file for reading
The full or relative path of the file
ASCII/Binary
Resume location
Async Callback
State object
IAsyncResult
Ends a call to BeginOpenRead()
IAsyncResult returned from BeginOpenRead()
A readable stream
Opens the specified file for writing
Full or relative path of the file
A stream for writing to the file on the server
Opens the specified file for writing
Full or relative path of the file
ASCII/Binary
A stream for writing to the file on the server
Opens the specified file for writing
Full or relative path of the file
Async callback
State object
IAsyncResult
Opens the specified file for writing
Full or relative path of the file
ASCII/Binary
Async callback
State object
IAsyncResult
Ends a call to BeginOpenWrite()
IAsyncResult returned from BeginOpenWrite()
A writable stream
Opens the specified file to be appended to
The full or relative path to the file to be opened
A stream for writing to the file on the server
Opens the specified file to be appended to
The full or relative path to the file to be opened
ASCII/Binary
A stream for writing to the file on the server
Opens the specified file for writing
Full or relative path of the file
Async callback
State object
IAsyncResult
Opens the specified file for writing
Full or relative path of the file
ASCII/Binary
Async callback
State object
IAsyncResult
Ends a call to BeginOpenAppend()
IAsyncResult returned from BeginOpenWrite()
A writable stream
Recursively dereferences a symbolic link. See the
MaximumDereferenceCount property for controlling
how deep this method will recurse before giving up.
The symbolic link
FtpListItem, null if the link can't be dereferenced
Recursively dereferences a symbolic link
The symbolic link
The maximum depth of recursion that can be performed before giving up.
FtpListItem, null if the link can't be dereferenced
Derefence a FtpListItem object asynchronously
The item to derefence
Maximum recursive calls
AsyncCallback
State Object
IAsyncResult
Derefence a FtpListItem object asynchronously. See the
MaximumDereferenceCount property for controlling
how deep this method will recurse before giving up.
The item to derefence
AsyncCallback
State Object
IAsyncResult
Ends a call to BeginDereferenceLink
IAsyncResult
FtpListItem, null if the link can't be dereferenced
Returns information about a file system object. You should check the Capabilities
flags for the FtpCapability.MLSD flag before calling this method. Failing to do
so will result in an InvalidOperationException being thrown when the server
does not support machine listings. Returns null if the server response can't
be parsed or the server returns a failure completion code. The error for a failure
is logged with FtpTrace. No exception is thrown on error because that would negate
the usefullness of this method for checking for the existence of an object.
The path of the object to retrieve information about
A FtpListItem object
Returns information about a file system object. You should check the Capabilities
flags for the FtpCapability.MLSD flag before calling this method. Failing to do
so will result in an InvalidOperationException being thrown when the server
does not support machine listings. Returns null if the server response can't
be parsed or the server returns a failure completion code. The error for a failure
is logged with FtpTrace. No exception is thrown on error because that would negate
the usefullness of this method for checking for the existence of an object.
Path of the item to retrieve information about
Async Callback
State object
IAsyncResult
Ends a call to BeginGetObjectInfo
IAsyncResult returned from BeginGetObjectInfo
FtpListItem if the command succeeded, null if there was a problem.
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.
An array of FtpListItem objects
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.
The path of the directory to list
An array of FtpListItem objects
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.
The path of the directory to list
Options that dictacte how a list is performed and what information is gathered.
An array of FtpListItem objects
Gets a file listing from the server asynchronously
AsyncCallback method
State object
IAsyncResult
Gets a file listing from the server asynchronously
The path to list
AsyncCallback method
State object
IAsyncResult
Gets a file listing from the server asynchronously
The path to list
Options that dictate how the list operation is performed
AsyncCallback method
State object
IAsyncResult
Ends an asynchronous file listing
IAsyncResult return from BeginGetListing()
An array of items retrieved in the listing
Returns a file/directory listing using the NLST command.
A string array of file and directory names if any were returned.
Returns a file/directory listing using the NLST command.
The path of the directory to list
A string array of file and directory names if any were returned.
Asynchronously gets a list of file and directory names for the specified path.
The path of the directory to list
Async Callback
State object
IAsyncResult
Asynchronously gets a list of file and directory names for the specified path.
Async Callback
State object
IAsyncResult
Ends a call to BeginGetNameListing()
IAsyncResult object returned from BeginGetNameListing
An array of file and directory names if any were returned.
Sets the work directory on the server
The path of the directory to change to
Asynchronously changes the working directory on the server
The directory to change to
Async Callback
State object
IAsyncResult
Ends asynchronous directory change
IAsyncResult returned from BeginSetWorkingDirectory
Gets the current working directory
The current working directory, ./ if the response couldn't be parsed.
Asynchronously retrieves the working directory
Async callback
State object
IAsyncResult
Ends an asynchronous call to retrieve the working directory
IAsyncResult returned from BeginGetWorkingDirectory
The current working directory
Gets the size of the file
The full or relative path of the file
-1 if the command fails, otherwise the file size
Asynchronously retrieve the size of the specified file
The full or relative path of the file
Async callback
State object
IAsyncResult
Ends a call to BeginGetFileSize()
IAsyncResult returned from BeginGetFileSize
The size of the file, -1 if there was a problem.
Gets the modified time of the file
The full path to the file
The modified time, DateTime.MinValue if there was a problem
Gets the modified time of the file
The full path to the file
Async callback
State object
IAsyncResult
Ends a call to BeginGetModifiedTime()
IAsyncResult returned from BeginGetModifiedTime()
The modified time, DateTime.MinValue if there was a problem
Deletes a file on the server
The full or relative path to the file
Asynchronously deletes a file from the server
The full or relative path to the file
Async callback
State object
IAsyncResult
Ends a call to BeginDeleteFile
IAsyncResult returned from BeginDeleteFile
Deletes the specified directory on the server.
The full or relative path of the directory to delete
Delets the specified directory on the server
The full or relative path of the directory to delete
If the directory is not empty, remove its contents
Deletes the specified directory on the server
The full or relative path of the directory to delete
If the directory is not empty, remove its contents
FtpListOptions for controlling how the directory
contents are retrieved with the force option is true. If you experience problems
the file listing can be fine tuned through this parameter.
Asynchronously removes a directory from the server
The full or relative path of the directory to delete
Async callback
State object
IAsyncResult
Asynchronously removes a directory from the server
The full or relative path of the directory to delete
If the directory is not empty, remove its contents
Async callback
State object
IAsyncResult
Asynchronously removes a directory from the server
The full or relative path of the directory to delete
If the directory is not empty, remove its contents
FtpListOptions for controlling how the directory
contents are retrieved with the force option is true. If you experience problems
the file listing can be fine tuned through this parameter.
Async callback
State object
IAsyncResult
Ends a call to BeginDeleteDirectory()
IAsyncResult returned from BeginDeleteDirectory
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.
The path of the directory
True if it exists, false otherwise.
Checks if a directory exists on the server asynchronously.
IAsyncResult
The full or relative path of the directory to check for
Async callback
State object
Ends a call to BeginDirectoryExists
IAsyncResult returned from BeginDirectoryExists
True if the directory exists. False otherwise.
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.
The full or relative path to the file
True if the file exists
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.
The full or relative path to the file
Options for controling the file listing used to
determine if the file exists.
True if the file exists
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.
The full or relative path to the file
Async callback
State object
IAsyncResult
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.
The full or relative path to the file
Options for controling the file listing used to
determine if the file exists.
Async callback
State object
IAsyncResult
Ends a call to BeginFileExists
IAsyncResult returned from BeginFileExists
True if the file exists
Creates a directory on the server. If the preceding
directories do not exist they are created.
The full or relative path to the new directory
Creates a directory on the server
The full or relative path to the directory to create
Try to force all non-existant pieces of the path to be created
Creates a directory asynchronously
The full or relative path to the directory to create
Async callback
State object
IAsyncResult
Creates a directory asynchronously
The full or relative path to the directory to create
Try to create the whole path if the preceding directories do not exist
Async callback
State object
IAsyncResult
Ends a call to BeginCreateDirectory
IAsyncResult returned from BeginCreateDirectory
Renames an object on the remote file system.
The full or relative path to the object
The old or new full or relative path including the new name of the object
Asynchronously renames an object on the server
The full or relative path to the object
The old or new full or relative path including the new name of the object
Async callback
State object
IAsyncResult
Ends a call to BeginRename
IAsyncResult returned from BeginRename
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
The FtpHashType flag or FtpHashType.NONE if there was a problem.
Asynchronously get the hash algorithm being used by the HASH command.
Async callback
State object
IAsyncResult
Ends a call to BeginGetHashAlgorithm
IAsyncResult returned from BeginGetHashAlgorithm
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
Hash Algorithm
Asynchronously sets the hash algorithm type to be used with the HASH command.
Hash algorithm to use
Async Callback
State object
IAsyncResult
Ends an asynchronous call to BeginSetHashAlgorithm
IAsyncResult returned from BeginSetHashAlgorithm
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
Full or relative path of the object to compute the hash for.
The hash of the file.
Asynchronously retrieves the hash for the specified file
The file you want the server to compute the hash for
AsyncCallback
State object
IAsyncResult
Ends an asynchronous call to BeginGetHash
IAsyncResult returned from BeginGetHash
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.
Gets a value indicating if this object has already been disposed.
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.
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.
Gets or sets a value indicating whether a test should be performed to
see if there is stale (unrequested data) sitting on the socket. In some
cases the control connection may time out but before the server closes
the connection it might send a 4xx response that was unexpected and
can cause synchronization errors with transactions. To avoid this
problem the Execute() method checks to see if there is any data
available on the socket before executing a command. On Azure hosting
platforms this check can cause an exception to be thrown. In order
to work around the exception you can set this property to false
which will skip the test entirely however doing so eliminates the
best effort attempt of detecting such scenarios. See this thread
for more details about the Azure problem:
https://netftp.codeplex.com/discussions/535879
Gets a value indicating if the connection is alive
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.
Gets or sets 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. Manually setting this value overrides automatic detection
based on the FEAT list; if you change this value it's always used
regardless of what the server advertises, if anything.
The server to connect to
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.
Credentials used for authentication
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).
Client certificates to be used in SSL authentication process
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.
Disconnect from the server without sending QUIT. This helps
work around IOExceptions caused by buggy connection resets
when closing the control connection.
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).
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).
Gets or sets the length of time in miliseconds for a data connection
to be established before giving up. Default is 15000 (15 seconds).
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).
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.
Gets the server capabilties represented by flags
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
Type of SSL to use, or none. Default is none. Explicit is TLS, Implicit is SSL.
Indicates if data channel transfers should be encrypted. Only valid if EncryptionMode
property is not equal to FtpSslMode.None.
Gets the type of system/server that we're
connected to.
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.
Used for internally syncrhonizing access to this
object from multiple threads
A list of asynchronoous methods that are in progress
Control connection socket stream
Performs a bitwise and to check if the specified
flag is set on the Capabilities enum property.
The capability to check for
True if the feature was found
Fires the SSL validation event
Event Args
Retretieves the delegate for the specified IAsyncResult and removes
it from the m_asyncmethods collection if the operation is successfull
Type of delegate to retrieve
The IAsyncResult to retrieve the delegate for
The delegate that generated the specified IAsyncResult
Clones the control connection for opening multipe data streams
A new control connection with the same property settings as this one
Retreives a reply from the server. Do not execute this method
unless you are sure that a reply has been sent, i.e., you
executed a command. Doing so will cause the code to hang
indefinitely waiting for a server reply that is never comming.
FtpReply representing the response from the server
Executes a command
The command to execute with optional format place holders
Format parameters to the command
The servers reply to the command
Executes a command
The command to execute
The servers reply to the command
Performs an asynchronouse execution of the specified command
The command to execute
The AsyncCallback method
State object
IAsyncResult
Ends an asynchronous command
IAsyncResult returned from BeginExecute
FtpReply object (never null).
Connect to the server. Throws ObjectDisposedException if this object has been disposed.
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.
Populates the capabilities flags based on capabilities
supported by this server. This method is overridable
so that new features can be supported
The reply object from the FEAT command. The InfoMessages property will
contain a list of the features the server supported delimited by a new line '\n' character.
Initiates a connection to the server
AsyncCallback method
State object
IAsyncResult
Ends an asynchronous connection attempt to the server
IAsyncResult returned from BeginConnect()
Catches the socket stream ssl validation event and fires the event handlers
attached to this object for validating SSL certificates
The stream that fired the event
The event args used to validate the certficate
Disconnect from the server
Initiates a disconnection on the server
AsyncCallback method
State object
IAsyncResult
Ends a call to BeginDisconnect
IAsyncResult returned from BeginDisconnect
Opens the specified type of passive data stream
Type of passive data stream to open
The command to execute that requires a data stream
Restart location in bytes for file transfer
A data stream ready to be used
Opens the specified type of active data stream
Type of passive data stream to open
The command to execute that requires a data stream
Restart location in bytes for file transfer
A data stream ready to be used
Opens a data stream.
The command to execute that requires a data stream
Restart location in bytes for file transfer
The data stream.
Disconnects a data stream
The data stream to close
Opens the specified file for reading
The full or relative path of the file
A stream for reading the file on the server
Opens the specified file for reading
The full or relative path of the file
ASCII/Binary
A stream for reading the file on the server
Opens the specified file for reading
The full or relative path of the file
Resume location
A stream for reading the file on the server
Opens the specified file for reading
The full or relative path of the file
ASCII/Binary
Resume location
A stream for reading the file on the server
Opens the specified file for reading
The full or relative path of the file
Async Callback
State object
IAsyncResult
Opens the specified file for reading
The full or relative path of the file
ASCII/Binary
Async Callback
State object
IAsyncResult
Opens the specified file for reading
The full or relative path of the file
Resume location
Async Callback
State object
IAsyncResult
Opens the specified file for reading
The full or relative path of the file
ASCII/Binary
Resume location
Async Callback
State object
IAsyncResult
Ends a call to BeginOpenRead()
IAsyncResult returned from BeginOpenRead()
A readable stream
Opens the specified file for writing
Full or relative path of the file
A stream for writing to the file on the server
Opens the specified file for writing
Full or relative path of the file
ASCII/Binary
A stream for writing to the file on the server
Opens the specified file for writing
Full or relative path of the file
Async callback
State object
IAsyncResult
Opens the specified file for writing
Full or relative path of the file
ASCII/Binary
Async callback
State object
IAsyncResult
Ends a call to BeginOpenWrite()
IAsyncResult returned from BeginOpenWrite()
A writable stream
Opens the specified file to be appended to
The full or relative path to the file to be opened
A stream for writing to the file on the server
Opens the specified file to be appended to
The full or relative path to the file to be opened
ASCII/Binary
A stream for writing to the file on the server
Opens the specified file for writing
Full or relative path of the file
Async callback
State object
IAsyncResult
Opens the specified file for writing
Full or relative path of the file
ASCII/Binary
Async callback
State object
IAsyncResult
Ends a call to BeginOpenAppend()
IAsyncResult returned from BeginOpenWrite()
A writable stream
Recursively dereferences a symbolic link. See the
MaximumDereferenceCount property for controlling
how deep this method will recurse before giving up.
The symbolic link
FtpListItem, null if the link can't be dereferenced
Recursively dereferences a symbolic link
The symbolic link
The maximum depth of recursion that can be performed before giving up.
FtpListItem, null if the link can't be dereferenced
Derefence a FtpListItem object
The item to derefence
Maximum recursive calls
Counter
FtpListItem, null if the link can't be dereferenced
Derefence a FtpListItem object asynchronously
The item to derefence
Maximum recursive calls
AsyncCallback
State Object
IAsyncResult
Derefence a FtpListItem object asynchronously. See the
MaximumDereferenceCount property for controlling
how deep this method will recurse before giving up.
The item to derefence
AsyncCallback
State Object
IAsyncResult
Ends a call to BeginDereferenceLink
IAsyncResult
FtpListItem, null if the link can't be dereferenced
Returns information about a file system object. You should check the Capabilities
flags for the FtpCapability.MLSD flag before calling this method. Failing to do
so will result in an InvalidOperationException being thrown when the server
does not support machine listings. Returns null if the server response can't
be parsed or the server returns a failure completion code. The error for a failure
is logged with FtpTrace. No exception is thrown on error because that would negate
the usefullness of this method for checking for the existence of an object.
The path of the object to retrieve information about
A FtpListItem object
Returns information about a file system object. You should check the Capabilities
flags for the FtpCapability.MLSD flag before calling this method. Failing to do
so will result in an InvalidOperationException being thrown when the server
does not support machine listings. Returns null if the server response can't
be parsed or the server returns a failure completion code. The error for a failure
is logged with FtpTrace. No exception is thrown on error because that would negate
the usefullness of this method for checking for the existence of an object.
Path of the item to retrieve information about
Async Callback
State object
IAsyncResult
Ends a call to BeginGetObjectInfo
IAsyncResult returned from BeginGetObjectInfo
FtpListItem if the command succeeded, null if there was a problem.
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.
An array of FtpListItem objects
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.
The path of the directory to list
An array of FtpListItem objects
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.
The path of the directory to list
Options that dictacte how a list is performed and what information is gathered.
An array of FtpListItem objects
Gets a file listing from the server asynchronously
AsyncCallback method
State object
IAsyncResult
Gets a file listing from the server asynchronously
The path to list
AsyncCallback method
State object
IAsyncResult
Gets a file listing from the server asynchronously
The path to list
Options that dictate how the list operation is performed
AsyncCallback method
State object
IAsyncResult
Ends an asynchronous file listing
IAsyncResult return from BeginGetListing()
An array of items retrieved in the listing
Returns a file/directory listing using the NLST command.
A string array of file and directory names if any were returned.
Returns a file/directory listing using the NLST command.
The path of the directory to list
A string array of file and directory names if any were returned.
Asynchronously gets a list of file and directory names for the specified path.
The path of the directory to list
Async Callback
State object
IAsyncResult
Asynchronously gets a list of file and directory names for the specified path.
Async Callback
State object
IAsyncResult
Ends a call to BeginGetNameListing()
IAsyncResult object returned from BeginGetNameListing
An array of file and directory names if any were returned.
Sets the data type of information sent over the data stream
ASCII/Binary
Asynchronously sets the data type on the server
ASCII/Binary
Async callback
State object
IAsyncResult
Ends a call to BeginSetDataType()
IAsyncResult returned from BeginSetDataType()
Sets the work directory on the server
The path of the directory to change to
Asynchronously changes the working directory on the server
The directory to change to
Async Callback
State object
IAsyncResult
Ends asynchronous directory change
IAsyncResult returned from BeginSetWorkingDirectory
获取当前工作目录
The current working directory, ./ if the response couldn't be parsed.
Asynchronously retrieves the working directory
Async callback
State object
IAsyncResult
Ends an asynchronous call to retrieve the working directory
IAsyncResult returned from BeginGetWorkingDirectory
The current working directory
Gets the size of the file
The full or relative path of the file
-1 if the command fails, otherwise the file size
Asynchronously retrieve the size of the specified file
The full or relative path of the file
Async callback
State object
IAsyncResult
Ends a call to BeginGetFileSize()
IAsyncResult returned from BeginGetFileSize
The size of the file, -1 if there was a problem.
Gets the modified time of the file
The full path to the file
The modified time, DateTime.MinValue if there was a problem
Gets the modified time of the file
The full path to the file
Async callback
State object
IAsyncResult
Ends a call to BeginGetModifiedTime()
IAsyncResult returned from BeginGetModifiedTime()
The modified time, DateTime.MinValue if there was a problem
Deletes a file on the server
The full or relative path to the file
Asynchronously deletes a file from the server
The full or relative path to the file
Async callback
State object
IAsyncResult
Ends a call to BeginDeleteFile
IAsyncResult returned from BeginDeleteFile
Deletes the specified directory on the server.
The full or relative path of the directory to delete
Delets the specified directory on the server
The full or relative path of the directory to delete
If the directory is not empty, remove its contents
Deletes the specified directory on the server
The full or relative path of the directory to delete
If the directory is not empty, remove its contents
FtpListOptions for controlling how the directory
contents are retrieved with the force option is true. If you experience problems
the file listing can be fine tuned through this parameter.
Asynchronously removes a directory from the server
The full or relative path of the directory to delete
Async callback
State object
IAsyncResult
Asynchronously removes a directory from the server
The full or relative path of the directory to delete
If the directory is not empty, remove its contents
Async callback
State object
IAsyncResult
Asynchronously removes a directory from the server
The full or relative path of the directory to delete
If the directory is not empty, remove its contents
FtpListOptions for controlling how the directory
contents are retrieved with the force option is true. If you experience problems
the file listing can be fine tuned through this parameter.
Async callback
State object
IAsyncResult
Ends a call to BeginDeleteDirectory()
IAsyncResult returned from BeginDeleteDirectory
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.
The path of the directory
True if it exists, false otherwise.
Checks if a directory exists on the server asynchronously.
IAsyncResult
The full or relative path of the directory to check for
Async callback
State object
Ends a call to BeginDirectoryExists
IAsyncResult returned from BeginDirectoryExists
True if the directory exists. False otherwise.
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.
The full or relative path to the file
True if the file exists
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.
The full or relative path to the file
Options for controling the file listing used to
determine if the file exists.
True if the file exists
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.
The full or relative path to the file
Async callback
State object
IAsyncResult
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.
The full or relative path to the file
Options for controling the file listing used to
determine if the file exists.
Async callback
State object
IAsyncResult
Ends a call to BeginFileExists
IAsyncResult returned from BeginFileExists
True if the file exists
Creates a directory on the server. If the preceding
directories do not exist they are created.
The full or relative path to the new directory
Creates a directory on the server
The full or relative path to the directory to create
Try to force all non-existant pieces of the path to be created
Creates a directory asynchronously
The full or relative path to the directory to create
Async callback
State object
IAsyncResult
Creates a directory asynchronously
The full or relative path to the directory to create
Try to create the whole path if the preceding directories do not exist
Async callback
State object
IAsyncResult
Ends a call to BeginCreateDirectory
IAsyncResult returned from BeginCreateDirectory
Renames an object on the remote file system.
The full or relative path to the object
The old or new full or relative path including the new name of the object
Asynchronously renames an object on the server
The full or relative path to the object
The old or new full or relative path including the new name of the object
Async callback
State object
IAsyncResult
Ends a call to BeginRename
IAsyncResult returned from BeginRename
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
The FtpHashType flag or FtpHashType.NONE if there was a problem.
Asynchronously get the hash algorithm being used by the HASH command.
Async callback
State object
IAsyncResult
Ends a call to BeginGetHashAlgorithm
IAsyncResult returned from BeginGetHashAlgorithm
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
Hash Algorithm
Asynchronously sets the hash algorithm type to be used with the HASH command.
Hash algorithm to use
Async Callback
State object
IAsyncResult
Ends an asynchronous call to BeginSetHashAlgorithm
IAsyncResult returned from BeginSetHashAlgorithm
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
Full or relative path of the object to compute the hash for.
The hash of the file.
Asynchronously retrieves the hash for the specified file
The file you want the server to compute the hash for
AsyncCallback
State object
IAsyncResult
Ends an asynchronous call to BeginGetHash
IAsyncResult returned from BeginGetHash
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.
Disconnects from the server, releases resources held by this
object.
Finalizer
Creates a new isntance of FtpClient
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.
The URI to parse
Indicates if a ssl certificate should be validated when using FTPS schemes
FtpClient object
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.
The URI to parse
FtpClient object
Opens a stream to the file specified by the URI
FTP/FTPS URI pointing at a file
Indicates if a ssl certificate should be validated when using FTPS schemes
ASCII/Binary mode
Restart location
Stream object
Opens a stream to the file specified by the URI
FTP/FTPS URI pointing at a file
Indicates if a ssl certificate should be validated when using FTPS schemes
ASCII/Binary mode
Stream object
Opens a stream to the file specified by the URI
FTP/FTPS URI pointing at a file
Indicates if a ssl certificate should be validated when using FTPS schemes
Stream object
Opens a stream to the file specified by the URI
FTP/FTPS URI pointing at a file
Stream object
Opens a stream to the file specified by the URI
FTP/FTPS URI pointing at a file
Indicates if a ssl certificate should be validated when using FTPS schemes
ASCII/Binary mode
Stream object
Opens a stream to the file specified by the URI
FTP/FTPS URI pointing at a file
Indicates if a ssl certificate should be validated when using FTPS schemes
Stream object
Opens a stream to the file specified by the URI
FTP/FTPS URI pointing at a file
Stream object
Opens a stream to the file specified by the URI
FTP/FTPS URI pointing at a file
Indicates if a ssl certificate should be validated when using FTPS schemes
ASCII/Binary mode
Stream object
Opens a stream to the file specified by the URI
FTP/FTPS URI pointing at a file
Indicates if a ssl certificate should be validated when using FTPS schemes
Stream object
Opens a stream to the file specified by the URI
FTP/FTPS URI pointing at a file
Stream object
Gets a value indicating if this object has already been disposed.
Gets the base stream for talking to the server via
the control connection.
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.
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.
Gets or sets a value indicating whether a test should be performed to
see if there is stale (unrequested data) sitting on the socket. In some
cases the control connection may time out but before the server closes
the connection it might send a 4xx response that was unexpected and
can cause synchronization errors with transactions. To avoid this
problem the Execute() method checks to see if there is any data
available on the socket before executing a command. On Azure hosting
platforms this check can cause an exception to be thrown. In order
to work around the exception you can set this property to false
which will skip the test entirely however doing so eliminates the
best effort attempt of detecting such scenarios. See this thread
for more details about the Azure problem:
https://netftp.codeplex.com/discussions/535879
Gets a value indicating if the connection is alive
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.
Gets a value indicating if this control connection is a clone. This property
is used with data streams to determine if the connection should be closed
when the stream is closed. Servers typically only allow 1 data connection
per control connection. If you try to open multiple data connections this
object will be cloned for 2 or more resulting in N new connections to the
server.
Gets or sets 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. Manually setting this value overrides automatic detection
based on the FEAT list; if you change this value it's always used
regardless of what the server advertises, if anything.
The server to connect to
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.
Credentials used for authentication
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).
Client certificates to be used in SSL authentication process
数据连接类型,默认为AutoPassive,它首先尝试与EPSV的连接,
如果失败,然后在放弃之前尝试PASV。 如果您确切知道需要哪种连接,
您可以通过在此处定义特定类型的被动或活动数据连接来略微提高性能。
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.
Disconnect from the server without sending QUIT. This helps
work around IOExceptions caused by buggy connection resets
when closing the control connection.
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).
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).
Gets or sets the length of time in miliseconds for a data connection
to be established before giving up. Default is 15000 (15 seconds).
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).
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.
Gets the server capabilties represented by flags
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
要使用的SSL类型,或无。 默认值为none。 显式是TLS,隐式是SSL。
Type of SSL to use, or none. Default is none. Explicit is TLS, Implicit is SSL.
Indicates if data channel transfers should be encrypted. Only valid if EncryptionMode
property is not equal to FtpSslMode.None.
Encryption protocols to use. Only valid if EncryptionMode property is not equal to FtpSslMode.None.
Default value is .NET Framework defaults from SslStream class.
触发事件以验证SSL证书。 如果未处理此事件,并且验证证书时出现错误,则连接将中止。
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.
Gets the type of system/server that we're
connected to.
Used internally to mark properties in the control connection that
should be cloned when opening a data connection.
Base class for data stream connections
Stream class used for talking. Used by FtpClient, extended by FtpDataStream
Used for tacking read/write activity on the socket
to determine if Poll() should be used to test for
socket conenctivity. The socket in this class will
not know it has been disconnected if the remote host
closes the connection first. Using Poll() avoids
the exception that would be thrown when trying to
read or write to the disconnected socket.
Fires the SSL certificate validation event
Certificate being validated
Certificate chain
Policy errors if any
True if it was accepted, false otherwise
Throws an InvalidOperationException
Ignored
Ignored
Throws an InvalidOperationException
Ignored
Flushes the stream
Bypass the stream and read directly off the socket.
The buffer to read into
The number of bytes read
Reads data from the stream
Buffer to read into
Where in the buffer to start
Number of bytes to be read
Reads a line from the socket
A line from the stream, null if there is nothing to read
Writes data to the stream
Buffer to write to stream
Where in the buffer to start
Number of bytes to be read
Writes a line to the stream using the specified encoding
Encoding used for writing the line
The data to write
Disposes the stream
Disconnects from server
Sets socket options on the underlying socket
SocketOptionLevel
SocketOptionName
SocketOptionValue
Connect to the specified host
The host to connect to
The port to connect to
Internet Protocol versions to support durring the connection phase
Activates SSL on this stream using default protocols. Fires the ValidateCertificate event.
If this event is not handled and there are SslPolicyErrors present, the certificate will
not be accepted.
The host to authenticate the certiciate against
Activates SSL on this stream using default protocols. Fires the ValidateCertificate event.
If this event is not handled and there are SslPolicyErrors present, the certificate will
not be accepted.
The host to authenticate the certiciate against
A collection of client certificates to use when authenticating the SSL stream
Activates SSL on this stream using the specified protocols. Fires the ValidateCertificate event.
If this event is not handled and there are SslPolicyErrors present, the certificate will
not be accepted.
The host to authenticate the certiciate against
A collection of client certificates to use when authenticating the SSL stream
A bitwise parameter for supported encryption protocols.
Instructs this stream to listen for connections on the specified address and port
The address to listen on
The port to listen on
Accepts a connection from a listening socket
Asynchronously accepts a connection from a listening socket
Completes a BeginAccept() operation
IAsyncResult returned from BeginAccept
The socket used for talking
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.
Gets the number of available bytes on the socket, 0 if the
socket has not been initalized. This property is used internally
by FtpClient in an effort to detect disconnections and gracefully
reconnect the control connection.
Gets a value indicating if this socket stream is connected
Gets a value indicating if encryption is being used
The non-encrypted stream
The encrypted stream
Underlying stream, could be a NetworkStream or SslStream
Gets a value indicating if this stream can be read
Gets a value indicating if this stream if seekable
Gets a value indicating if this stream can be written to
Gets the length of the stream
Gets the current position of the stream. Trying to
set this property throws an InvalidOperationException()
Event is fired when a SSL certificate needs to be validated
Gets or sets the amount of time to wait for a read operation to complete. Default
value is Timeout.Infinite.
Gets or sets the length of time miliseconds to wait
for a connection succeed before giving up. The default
is 30000 (30 seconds).
Gets the local end point of the socket
Gets the remote end point of the socket
Reads data off the stream
The buffer to read into
Where to start in the buffer
Number of bytes to read
The number of bytes read
Writes data to the stream
The buffer to write to the stream
Where to start in the buffer
The number of bytes to write to the buffer
Sets the length of this stream
Value to apply to the Length property
Sets the position of the stream. Inteneded to be used
internally by FtpControlConnection.
The position
Disconnects (if necessary) and releases associated resources
Disposing
Closes the connection and reads the server's reply
Creates a new data stream object
The control connection to be used for carrying out this operation
Finalizer
Gets the status of the command that was used to open
this data channel
Gets or sets the control connection for this data stream. Setting
the control connection causes the object to be clonded and a new
connection is made to the server to carry out the task. This ensures
that multiple streams can be opened simultainously.
Gets or sets the length of the stream. Only valid for file transfers
and only valid on servers that support the Size command.
Gets or sets the position of the stream
定义要使用的加密类型
纯文本.
从连接开始使用加密,端口990
Encryption is used from the start of the connection, port 990
连接以纯文本开始,并在服务器问候后立即使用AUTH命令启用加密。
Connection starts in plain text and encryption is enabled
with the AUTH command immediately after the server greeting.
服务器响应的响应类型
The type of response the server responded with
No response
Success
Successs
Succcess
Temporary failure
Permanent failure
Server features
This server said it doesn't support anything!
Supports the MLST command
Supports the SIZE command
Supports the MDTM command
Supports download/upload stream resumes
Supports UTF8
PRET Command used in distributed ftp server software DrFTPD
Server supports the MFMT command for setting the
modifid date of an object on the server
Server supports the MFCT command for setting the
created date of an object on the server
Server supports the MFF command for setting certain facts
about file sytem objects. If you need this command, it would
probably be handy to query FEAT your self and have a look at
the FtpReply.InfoMessages property to see which facts the server
allows you to modify.
Server supports the STAT command
Support for the HASH command
Support for the non-standard MD5 command
Support for the non-standard XMD5 command
Support for the non-standard XCRC command
Support for the non-standard XSHA1 command
Support for the non-standard XSHA256 command
Support for the non-standard XSHA512 command
Different types of hashing algorithms for computing checksums.
HASH command is not supported
SHA-1
SHA-256
SHA-512
MD5
CRC
IP Versions to allow when connecting
to a server.
Internet Protocol Version 4
Internet Protocol Version 6
Allow any supported version
数据连接类型
Data connection type
这种类型的数据连接的尝试使用EPSV命令
如果服务器不支持EPSV它属于回放弃,除非你是通过IPv6连接之前
PASV命令
在这种情况下,不支持PASV命令。
被动数据连接。 EPSV是一个更好的
如果支持选项。被动连接
连接到由服务器dicated的IP地址
其可以是或可以不是由客户端可访问的
例如NAT设备后面的服务器可能
其本地网络上得到的IP地址,该地址
是不可访问的客户端。请注意,IPv6的
不支持这种类型的数据连接。 如果你
要求PASV并通过IPv6 EPSV连接会
自动在它的位置被使用。
同PASV除由服务器提供的主机被忽略
和数据conncetion是到同一个地址时,该控制
连接被连接到。这在情景如在
服务器在提供私人/不可路由的网络地址
PASV响应。这是功能上等同于EPSV除了一些
服务器可能无法实现EPSV命令。请注意,IPv6的
不支持这种类型的数据连接。 如果你
要求PASV并通过IPv6 EPSV连接会
自动在它的位置被使用。
被动扩展的数据连接,推荐。 作品
相同,除了与服务器的PASV连接
没有规定以连接到一个IP地址,而不是
被动连接去使用相同的地址
在控制连接。这种类型的数据连接的
支持IPv4和IPv6。
这种类型的数据连接的尝试使用EPRT命令
如果服务器不支持EPRT它属于回放弃,除非你是通过IPv6连接之前
PORT命令
在这种情况下不支持PORT命令。
有效的数据连接,不推荐,除非
你有使用这种类型的具体原因。
创建客户端上的监听套接字其中
需要在客户端系统上的防火墙例外
连接到时以及客户端网络
客户端的网络之外的服务器。 此外
使用的接口的IP地址,连接到
服务器是服务器被告知连接到地址
,如果后面的NAT设备,可能无法访问
服务器。这种类型的数据连接的不支持
通过了IPv6。如果指定端口,并通过IPv6连接
EPRT将自动替代使用。
扩展有效的数据连接,不推荐
除非你有使用此特定的原因
类型。创建客户端上的监听套接字
这需要在客户端防火墙例外
连接到时以及客户端网络
客户端的网络之外的服务器。服务器
连接到IP地址它看到客户正在添加
而来。这种类型的数据连接的支持IPv4和IPv6。
数据传输类型
Type of data transfer to do
ASCII transfer
Binary transfer
Type of file system of object
A file
A directory
A symbolic link
Types of file permissions
No access
Executable
Writeable
Readable
Types of special UNIX permissions
No special permissions are set
Sticky bit is set
SGID bit is set
SUID bit is set
Flags that can dicate how a file listing is performed
Load the modify date using MDTM when it could not
be parsed from the server listing. This only pertains
to servers that do not implement the MLSD command.
Load the file size using the SIZE command when it
could not be parsed from the server listing. This
only pertains to servers that do not support the
MLSD command.
Combines the Modify and Size flags
Show hidden/dot files. This only pertains to servers
that do not support the MLSD command. This option
makes use the non standard -a parameter to LIST to
tell the server to show hidden files. Since it's a
non-standard option it may not always work. MLSD listings
have no such option and whether or not a hidden file is
shown is at the discretion of the server.
Force the use of the NLST command even if MLSD
is supported by the server
Use the NLST command instead of LIST for a reliable file listing
Combines the ForceList and NameList flags
Try to dereference symbolic links
Sets the ForceList flag and uses `LS' instead of `LIST' as the
command for getting a directory listing. This option overrides
ForceNameList and ignores the AllFiles flag.
Adds the -r option to the list command. Some servers may not
support this feature.
Do not retrieve path when no path is supplied to GetListing(),
instead just execute LIST with no path argument.
FTP related error
Initializes the exception object
The error message
Exception triggered on command failures
Initalizes a new instance of a FtpResponseException
Status code
Associated message
Initalizes a new instance of a FtpResponseException
The FtpReply to build the exception from
Gets the completion code associated with the response
The type of response received from the last command executed
Exception is thrown when encryption could not be negotiated by the server
Default constructor
Custom error message
Error message
Extension methods related to FTP tasks
Converts the specified path into a valid FTP file system path
The file system path
A path formatted for FTP
Creates a valid FTP path by appending the specified segments to this string
This string
The path segments to append
A valid FTP path
Gets the directory name of a path formatted for a FTP server
The path
The parent directory path
Gets the file name from the path
The full path to the file
The file name
尝试将字符串FTP数据表示转换成一个日期时间对象
Tries to convert the string FTP date representation into a date time object
The date
UTC/Local Time
代表日期的日期时间对象,DateTime.MinValue如果有问题 A date time object representing the date, DateTime.MinValue if there was a problem
Represents a computed hash of an object
on the FTP server. See the following link
for more information:
http://tools.ietf.org/html/draft-bryan-ftpext-hash-02
Computes the hash for the specified file and compares
it to the value in this object. CRC hashes are not supported
because there is no built-in support in the .net framework and
a CRC implementation exceeds the scope of this project. If you
attempt to Verify() a CRC hash a NotImplemented() exception will
be thrown.
The file to compute the hash for
True if the computed hash matches what's stored in this object.
Computes the hash for the specified stream and compares
it to the value in this object. CRC hashes are not supported
because there is no built-in support in the .net framework and
a CRC implementation exceeds the scope of this project. If you
attempt to Verify() a CRC hash a NotImplemented() exception will
be thrown.
The stream to compute the hash for
True if the computed hash matches what's stored in this object.
Creates an empty instance.
Gets the algorithm that was used to compute the hash
Gets the computed hash returned by the server
Gets a value indicating if this object represents a
valid hash response from the server.
Represents a file system object on the server
Represents a file system object on the server
Returns a string representation of this object and its properties
A string value
Gets the type of file system object. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the full path name to the object. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the name of the object. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the target a symbolic link points to. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the object the LinkTarget points to. This property is null unless pass the
FtpListOption.DerefLink flag in which case GetListing() will try to resolve
the target itself.
Gets the last write time of the object. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the created date of the object. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the size of the object. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets special UNIX permissions such as Stiky, SUID and SGID. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the owner permissions. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the group permissions. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the others permissions. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the input string that was parsed to generate the
values in this object. This property can be
set however this functionality is intended to be done by
custom parsers.
Returns a string representation of this object and its properties
A string value
Parses a line from a file listing using the first successful match in the Parsers collection.
The source path of the file listing
A line from the file listing
Server capabilities
A FtpListItem object representing the parsed line, null if the line was
unable to be parsed. If you have encountered an unsupported list type add a parser
to the public static Parsers collection of FtpListItem.
Used for synchronizing access to the Parsers collection
Initalizes the default list of parsers
Adds a custom parser
The parser delegate to add
Removes all parser delegates
Removes the specified parser
The parser delegate to remove
Parses MLS* format listings
A line from the listing
Server capabilities
FtpListItem if the item is able to be parsed
Parses LIST format listings
A line from the listing
Server capabilities
FtpListItem if the item is able to be parsed
Parses IIS DOS format listings
A line from the listing
Server capabilities
FtpListItem if the item is able to be parsed
Gets the type of file system object. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the full path name to the object. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the name of the object. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the target a symbolic link points to. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the object the LinkTarget points to. This property is null unless pass the
FtpListOption.DerefLink flag in which case GetListing() will try to resolve
the target itself.
Gets the last write time of the object. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the created date of the object. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the size of the object. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets special UNIX permissions such as Stiky, SUID and SGID. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the owner permissions. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the group permissions. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the others permissions. This property can be
set however this functionality is intended to be done by
custom parsers.
Gets the input string that was parsed to generate the
values in this object. This property can be
set however this functionality is intended to be done by
custom parsers.
Collection of parsers. Each parser object contains
a regex string that uses named groups, i.e., (?<group_name>foobar).
The support group names are modify for last write time, size for the
size and name for the name of the file system object. Each group name is
optional, if they are present then those values are retrieved from a
successful match. In addition, each parser contains a Type property
which gets set in the FtpListItem object to distinguish between different
types of objects.
Ftp listing line parser
The line from the listing
The server capabilities
FtpListItem if the line can be parsed, null otherwise
Represents a reply to an event on the server
Represents a reply to an event on the server
The type of response received from the last command executed
The status code of the response
The message, if any, that the server sent with the response
Informational messages sent from the server
General success or failure of the last command executed
Gets the error message including any informational output
that was sent by the server. Sometimes the final response
line doesn't contain anything informative as to what was going
on with the server. Instead it may send information messages so
in an effort to give as meaningful as a response as possible
the informational messages will be included in the error.
The type of response received from the last command executed
The status code of the response
The message, if any, that the server sent with the response
Informational messages sent from the server
General success or failure of the last command executed
Gets the error message including any informational output
that was sent by the server. Sometimes the final response
line doesn't contain anything informative as to what was going
on with the server. Instead it may send information messages so
in an effort to give as meaningful as a response as possible
the informational messages will be included in the error.
Event fired if a bad SSL certificate is encountered. This even is used internally; if you
don't have a specific reason for using it you are probably looking for FtpSslValidation.
Event args for the FtpSslValidationError delegate
The certificate to be validated
The certificate chain
Validation errors, if any.
Gets or sets a value indicating if this certificate should be accepted. The default
value is false. If the certificate is not accepted, an AuthenticationException will
be thrown.
Used for transaction logging and debug information.
The following example illustrates how to assist in debugging
System.Net.FtpClient by getting a transaction log from the server.
Add a TraceListner to the collection. You can use one of the predefined
TraceListeners in the System.Diagnostics namespace, such as ConsoleTraceListener
for logging to the console, or you can write your own deriving from
System.Diagnostics.TraceListener.
The TraceListener to add to the collection
Remove the specified TraceListener from the collection
The TraceListener to remove from the collection.
Write to the TraceListeners.
The message to write
Optional variables if using a format string similar to string.Format()
Write to the TraceListeners
The message to write
Write to the TraceListeners.
The message to write
Optional variables if using a format string similar to string.Format()
Write to the TraceListeners
The message to write
Gets or sets whether the trace listeners should be flushed or not
after writing to them. Default value is false.
Implementation of the non-standard XCRC command
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.
FtpClient object
The path of the file you'd like the server to compute the CRC value for.
The response from the server, typically the CRC value. FtpCommandException thrown on error
Asynchronusly retrieve a CRC hash. The XCRC command is non-standard
and not guaranteed to work.
FtpClient Object
Full or relative path to remote file
AsyncCallback
State Object
IAsyncResult
Ends an asynchronous call to BeginGetXCRC()
IAsyncResult returned from BeginGetXCRC()
The CRC hash of the specified file.
Implementation of non-standard XMD5 command.
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.
FtpClient Object
Full or relative path to remote file
Server response, presumably the MD5 hash.
Asynchronusly retrieve a MD5 hash. The XMD5 command is non-standard
and not guaranteed to work.
FtpClient Object
Full or relative path to remote file
AsyncCallback
State Object
IAsyncResult
Ends an asynchronous call to BeginGetXMD5()
IAsyncResult returned from BeginGetXMD5()
The MD5 hash of the specified file.
Implementation of the non-standard XSHA1 command
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.
FtpClient Object
Full or relative path to remote file
Server response, presumably the SHA-1 hash.
Asynchronusly retrieve a SHA1 hash. The XSHA1 command is non-standard
and not guaranteed to work.
FtpClient Object
Full or relative path to remote file
AsyncCallback
State Object
IAsyncResult
Ends an asynchronous call to BeginGetXSHA1()
IAsyncResult returned from BeginGetXSHA1()
The SHA-1 hash of the specified file.
Implementation of the non-standard XSHA256 command
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.
FtpClient Object
Full or relative path to remote file
Server response, presumably the SHA-256 hash.
Asynchronusly retrieve a SHA256 hash. The XSHA256 command is non-standard
and not guaranteed to work.
FtpClient Object
Full or relative path to remote file
AsyncCallback
State Object
IAsyncResult
Ends an asynchronous call to BeginGetXSHA256()
IAsyncResult returned from BeginGetXSHA256()
The SHA-256 hash of the specified file.
Implementation of the non-standard XSHA512 command
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.
FtpClient Object
Full or relative path to remote file
Server response, presumably the SHA-512 hash.
Asynchronusly retrieve a SHA512 hash. The XSHA512 command is non-standard
and not guaranteed to work.
FtpClient Object
Full or relative path to remote file
AsyncCallback
State Object
IAsyncResult
Ends an asynchronous call to BeginGetXSHA512()
IAsyncResult returned from BeginGetXSHA512()
The SHA-512 hash of the specified file.