Table of Contents

Class FtpConfig

Namespace
FluentFTP
Assembly
FluentFTP.dll

Holds all the configuration settings for a single FTP client. One FtpConfig object can only be bound to one client at a time. If you want to reuse it across multiple FTP clients, then clone it and then reuse it.

public class FtpConfig
Inheritance
FtpConfig
Inherited Members
Extension Methods

Constructors

FtpConfig()

public FtpConfig()

Fields

_customParser

protected FtpConfig.CustomParser _customParser

Field Value

FtpConfig.CustomParser

_keepAlive

protected bool _keepAlive

Field Value

bool

_localTimeOffset

protected TimeSpan _localTimeOffset

Field Value

TimeSpan

_localTimeZone

protected double _localTimeZone

Field Value

double

_parser

protected FtpParser _parser

Field Value

FtpParser

_retryAttempts

protected int _retryAttempts

Field Value

int

_serverTimeOffset

protected TimeSpan _serverTimeOffset

Field Value

TimeSpan

_serverTimeZone

protected double _serverTimeZone

Field Value

double

_socketPollInterval

protected int _socketPollInterval

Field Value

int

Properties

ActivePorts

Ports used for Active Data Connection. Useful when your FTP server has certain ports that are blocked or used for other purposes.

public IEnumerable<int> ActivePorts { get; set; }

Property Value

IEnumerable<int>

AddressResolver

Delegate used for resolving local address, used for active data connections This can be used in case you're behind a router, but port forwarding is configured to forward the ports from your router to your internal IP. In that case, we need to send the router's IP instead of our internal IP.

public Func<string> AddressResolver { get; set; }

Property Value

Func<string>

BulkListing

If true, increases performance of GetListing by reading multiple lines of the file listing at once. If false then GetListing will read file listings line-by-line. If GetListing is having issues with your server, set it to false.

The number of bytes read is based upon BulkListingLength.

public bool BulkListing { get; set; }

Property Value

bool

BulkListingLength

Bytes to read during GetListing. Only honored if BulkListing is true.

public int BulkListingLength { get; set; }

Property Value

int

CheckCapabilities

When this value is set to true (default) the control connection will set which features are available by executing the FEAT command when the connect method is called.

public bool CheckCapabilities { get; set; }

Property Value

bool

Client

Which FtpClient are we bound to?

public BaseFtpClient Client { get; }

Property Value

BaseFtpClient

ClientCertificates

Client certificates to be used in SSL authentication process

public X509CertificateCollection ClientCertificates { get; protected set; }

Property Value

X509CertificateCollection

ConnectTimeout

Gets or sets the length of time in milliseconds to wait for a connection attempt to succeed before giving up. Default is 0 (Use OS default timeout) See: https://github.com/robinrodricks/FluentFTP/wiki/FTP-Connection#connection-timeout-settings and: https://github.com/robinrodricks/FluentFTP/wiki/FTP-Connection#faq_timeoutwindows

public int ConnectTimeout { get; set; }

Property Value

int

CustomStream

Used to set a custom stream handler, for example to integrate with the FluentFTP.GnuTLS package.

public Type CustomStream { get; set; }

Property Value

Type

CustomStreamConfig

Used to set the configuration for a custom stream handler, for example to integrate with the FluentFTP.GnuTLS package.

public IFtpStreamConfig CustomStreamConfig { get; set; }

Property Value

IFtpStreamConfig

DataConnectionConnectTimeout

Gets or sets the length of time in milliseconds for a data connection to be established before giving up. Default is 15000 (15 seconds).

public int DataConnectionConnectTimeout { get; set; }

Property Value

int

DataConnectionEncryption

Indicates if data channel transfers should be encrypted. Only valid if EncryptionMode property is not equal to None.

public bool DataConnectionEncryption { get; set; }

Property Value

bool

DataConnectionReadTimeout

Gets or sets the length of time in milliseconds the data channel should wait for the server to send data. Default value is 15000 (15 seconds).

public int DataConnectionReadTimeout { get; set; }

Property Value

int

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 specific type of passive or active data connection here.

public FtpDataConnectionType DataConnectionType { get; set; }

Property Value

FtpDataConnectionType

DisconnectWithQuit

Disconnect from the server without sending QUIT. This helps work around IOExceptions caused by buggy connection resets when closing the control connection.

public bool DisconnectWithQuit { get; set; }

Property Value

bool

DownloadDataType

Controls if the high-level API downloads files in Binary or ASCII mode.

public FtpDataType DownloadDataType { get; set; }

Property Value

FtpDataType

DownloadDirectoryDeleteExcluded

Controls if the DownloadDirectory API deletes the excluded files when downloading in Mirror mode. If true, then any files that are excluded will be deleted from the local filesystem if they are excluded from the FTP server. This is done to keep the local filesystem in sync with the FTP server. But if it is false, the excluded files are not touched on the local filesystem, and simply ignored.

public bool DownloadDirectoryDeleteExcluded { get; set; }

Property Value

bool

DownloadRateLimit

Rate limit for downloads in kbytes/s. Set this to 0 for unlimited speed. Honored by high-level API such as Upload(), Download(), UploadFile(), DownloadFile()..

public uint DownloadRateLimit { get; set; }

Property Value

uint

DownloadZeroByteFiles

Controls if zero-byte files should be downloaded or skipped. If false, then no file is created/overwritten into the filesystem.

public bool DownloadZeroByteFiles { get; set; }

Property Value

bool

EncryptionMode

Type of SSL to use, or none. Default is none. Explicit is TLS, Implicit is SSL.

public FtpEncryptionMode EncryptionMode { get; set; }

Property Value

FtpEncryptionMode

FXPDataType

Controls if the FXP server-to-server file transfer API uses Binary or ASCII mode.

public FtpDataType FXPDataType { get; set; }

Property Value

FtpDataType

FXPProgressInterval

Controls how often the progress reports are sent during an FXP file transfer. The default value is 1000 (1 second).

public int FXPProgressInterval { get; set; }

Property Value

int

InternetProtocolVersions

Flags specifying which versions of the internet protocol (IPV4 or IPV6) 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.

public FtpIpVersion InternetProtocolVersions { get; set; }

Property Value

FtpIpVersion

ListingCulture

Culture used to parse file listings

public CultureInfo ListingCulture { get; set; }

Property Value

CultureInfo

ListingCustomParser

Custom file listing parser to be used.

public FtpConfig.CustomParser ListingCustomParser { get; set; }

Property Value

FtpConfig.CustomParser

ListingDataType

Controls if the file listings are downloaded in Binary or ASCII mode.

public FtpDataType ListingDataType { get; set; }

Property Value

FtpDataType

ListingParser

File listing parser to be used. Automatically calculated based on the type of the server at the time of connection. If you want to override this property, make sure to do it after calling Connect.

public FtpParser ListingParser { get; set; }

Property Value

FtpParser

LocalFileBufferSize

Gets or sets the size of the file buffer when reading and writing files on the local file system. Used by / and / and all the other file and directory transfer methods.

public int LocalFileBufferSize { get; set; }

Property Value

int

LocalFileShareOption

Gets or sets the FileShare setting to be used when opening a FileReadStream for uploading to the server, which needs to be set to FileShare.ReadWrite in special cases to avoid denied access.

public FileShare LocalFileShareOption { get; set; }

Property Value

FileShare

LocalTimeZone

The timezone of your machine. If your machine is in Tokyo with UTC+9 then set this to 9. If your machine is synchronized with UTC then keep this 0.

public double LocalTimeZone { get; set; }

Property Value

double

LogDurations

Should the command duration be shown after each log command?

public bool LogDurations { get; set; }

Property Value

bool

LogHost

Should the FTP server host IP/domain be shown in the logs (true) or masked out (false)?

public bool LogHost { get; set; }

Property Value

bool

LogPassword

Should the FTP password be shown in the logs (true) or masked out (false)?

public bool LogPassword { get; set; }

Property Value

bool

LogToConsole

Should the function calls be logged in Verbose mode?

public bool LogToConsole { get; set; }

Property Value

bool

LogUserName

Should the FTP username be shown in the logs (true) or masked out (false)?

public bool LogUserName { get; set; }

Property Value

bool

Navigate

Directory navigation mode that controls how server-side directory traversal is performed. Manual mode is the legacy version which allows users full control of the working directory. All the other modes are smarter automatic versions where FluentFTP will take control of the working directory.

public FtpNavigate Navigate { get; set; }

Property Value

FtpNavigate

Noop

Install the NOOP Daemon whenever an FTP connection is established, which ensures that NOOPs are sent at regular intervals. This is the master switch for all NOOP functionality.

public bool Noop { get; set; }

Property Value

bool

NoopActiveCommands

These commands are to be used when the dataconnection is active, i.e. a transfer is taking place. Default: NOOP

public List<string> NoopActiveCommands { get; set; }

Property Value

List<string>

NoopInactiveCommands

These commands are to be used when the dataconnection is not active, i.e. no transfer is taking place. Default: NOOP, PWD, TYPE I, TYPE A

public List<string> NoopInactiveCommands { get; set; }

Property Value

List<string>

NoopInterval

Gets or sets the length of time in milliseconds after last command (NOOP or other) that a NOOP command is sent./>. This is called during downloading/uploading and idle times. Setting this interval to 0 stops NOOPs from being issued. The default value is 3 minutes, which catches the typical 5 minute timeout by FTP servers.

public int NoopInterval { get; set; }

Property Value

int

NoopTestConnectivity

Issue a NOOP command tp precede any command issued on the control connection to test connectivity in a reliable fashion. Note: This can incur some control connection overhead and does not alleviate inactivity timeouts, it just helps to identify connectivity issues early on.

public bool NoopTestConnectivity { get; set; }

Property Value

bool

PassiveBlockedPorts

Ports blocked for Passive Data Connection (PASV and EPSV). Useful when your FTP server has certain ports that are blocked or used for other purposes.

public IEnumerable<int> PassiveBlockedPorts { get; set; }

Property Value

IEnumerable<int>

PassiveMaxAttempts

Maximum number of passive connections made in order to find a working port for Passive Data Connection (PASV and EPSV). Only used if PassiveBlockedPorts is non-null.

public int PassiveMaxAttempts { get; set; }

Property Value

int

PostConnect

Enables/disables the init sequence performed immediately after connection for some servers, like IBM OS/400.

public bool PostConnect { get; set; }

Property Value

bool

ReadTimeout

Gets or sets the length of time wait in milliseconds for data to be read from the underlying stream. The default value is 15000 (15 seconds).

public int ReadTimeout { get; set; }

Property Value

int

RetryAttempts

Gets or sets the retry attempts allowed when a verification failure occurs during download or upload. This value must be set to 1 or more.

public int RetryAttempts { get; set; }

Property Value

int

SendHost

Controls if the HOST command is sent immediately after the handshake. Useful when you are using shared hosting and you need to inform the FTP server which domain you want to connect to.

public bool SendHost { get; set; }

Property Value

bool

SendHostDomain

Controls which domain is sent with the HOST command. If this is null, then the Host parameter of the FTP client is sent.

public string SendHostDomain { get; set; }

Property Value

string

SocketKeepAlive

Gets or sets a value indicating if 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.

public bool SocketKeepAlive { get; set; }

Property Value

bool

SocketLocalIp

The local socket will be bound to the given local IP/interface. This is useful if you have several usable public IP addresses and want to use a particular one.

public IPAddress SocketLocalIp { get; set; }

Property Value

IPAddress

SocketPollInterval

Gets or sets the length of time in milliseconds that must pass since the last socket activity before calling Poll(int, SelectMode) on the socket to test for connectivity. Setting this interval too low will have a negative impact on performance. Setting this interval to 0 disables Polling all together. The default value is 15 seconds.

public int SocketPollInterval { get; set; }

Property Value

int

SslProtocols

Encryption protocols to use. Only valid if EncryptionMode property is not equal to None. Default value is .NET Framework defaults from the SslStream class.

public SslProtocols SslProtocols { get; set; }

Property Value

SslProtocols

SslSessionLength

Gets or sets the max number of socket write/read transactions before an automatic disconnect/reconnect is performed. This is required to bypass an SSL issue that occurs after a specific number of transactions. Set to zero to disable automatic reconnects.

public int SslSessionLength { get; set; }

Property Value

int

StaleDataCheck

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 method checks to see if there is any data available on the socket before executing a command.

public bool StaleDataCheck { get; set; }

Property Value

bool

TimeConversion

Server timestamps are converted into the given timezone. ServerTime will return the original timestamp. LocalTime will convert the timestamp into your local machine's timezone. UTC will convert the timestamp into UTC format (GMT+0). You need to set TimeZone and LocalTimeZone (.NET core only) for these to work.

public FtpDate TimeConversion { get; set; }

Property Value

FtpDate

TimeZone

The timezone of the FTP server. If the server is in Tokyo with UTC+9 then set this to 9. If the server returns timestamps in UTC then keep this 0.

public double TimeZone { get; set; }

Property Value

double

TransferChunkSize

Gets or sets the number of bytes transferred in a single chunk (a single FTP command). Used by / and / to transfer large files in multiple chunks.

public int TransferChunkSize { get; set; }

Property Value

int

UploadDataType

Controls if the high-level API uploads files in Binary or ASCII mode.

public FtpDataType UploadDataType { get; set; }

Property Value

FtpDataType

UploadDirectoryDeleteExcluded

Controls if the UploadDirectory API deletes the excluded files when uploading in Mirror mode. If true, then any files that are excluded will be deleted from the FTP server if they are excluded from the local system. This is done to keep the server in sync with the local system. But if it is false, the excluded files are not touched on the server, and simply ignored.

public bool UploadDirectoryDeleteExcluded { get; set; }

Property Value

bool

UploadRateLimit

Rate limit for uploads in kbyte/s. Set this to 0 for unlimited speed. Honored by high-level API such as Upload(), Download(), UploadFile(), DownloadFile()..

public uint UploadRateLimit { get; set; }

Property Value

uint

ValidateAnyCertificate

Accept any SSL certificate received from the server and skip performing the validation using the ValidateCertificate callback. Useful for Powershell users.

public bool ValidateAnyCertificate { get; set; }

Property Value

bool

ValidateCertificateRevocation

Indicates if the certificate revocation list is checked during authentication. Useful when you need to maintain the certificate chain validation, but skip the certificate revocation check. WARNING: Enabling this can cause memory leaks in some conditions (see issue #710 for details).

public bool ValidateCertificateRevocation { get; set; }

Property Value

bool

VerifyMethod

Defines which verification types should be performed when uploading/downloading files using the high-level APIs. Multiple verification types can be combined.

public FtpVerifyMethod VerifyMethod { get; set; }

Property Value

FtpVerifyMethod

Methods

BindTo(BaseFtpClient)

Bind this FtpConfig object to the given FTP client.

public void BindTo(BaseFtpClient client)

Parameters

client BaseFtpClient

Clone()

Return a deep clone of this FtpConfig object.

public FtpConfig Clone()

Returns

FtpConfig

CopyTo(FtpConfig, FtpConfig)

Copy settings from one config object to another.

public static void CopyTo(FtpConfig read, FtpConfig write)

Parameters

read FtpConfig
write FtpConfig

GetLocalTimeOffset()

public TimeSpan GetLocalTimeOffset()

Returns

TimeSpan

GetServerTimeOffset()

public TimeSpan GetServerTimeOffset()

Returns

TimeSpan