Table of Contents

Class FtpBaseServer

Namespace
FluentFTP.Servers
Assembly
FluentFTP.dll

The base class used for all FTP server specific support. You may extend this class to implement support for custom FTP servers.

public abstract class FtpBaseServer
Inheritance
FtpBaseServer
Inherited Members
Extension Methods

Constructors

FtpBaseServer()

protected FtpBaseServer()

Methods

AfterConnected(FtpClient)

Perform server-specific post-connection commands here. Return true if you executed a server-specific command.

public virtual void AfterConnected(FtpClient client)

Parameters

client FtpClient

AfterConnectedAsync(AsyncFtpClient, CancellationToken)

Perform server-specific post-connection commands here. Return true if you executed a server-specific command.

public virtual Task AfterConnectedAsync(AsyncFtpClient client, CancellationToken token)

Parameters

client AsyncFtpClient
token CancellationToken

Returns

Task

AlwaysReadToEnd(string)

Always read to end of stream on a download If you are unsure, return false.

public virtual bool AlwaysReadToEnd(string remotePath)

Parameters

remotePath string

Returns

bool

CalculateFullFtpPath(BaseFtpClient, string, FtpListItem)

Get the full path of a given FTP Listing entry Return null indicates custom code decided not to handle this

public virtual bool? CalculateFullFtpPath(BaseFtpClient client, string path, FtpListItem item)

Parameters

client BaseFtpClient
path string
item FtpListItem

Returns

bool?

CreateDirectory(FtpClient, string, string, bool)

Perform server-specific create directory commands here. Return true if you executed a server-specific command.

public virtual bool CreateDirectory(FtpClient client, string path, string ftppath, bool force)

Parameters

client FtpClient
path string
ftppath string
force bool

Returns

bool

CreateDirectoryAsync(AsyncFtpClient, string, string, bool, CancellationToken)

Perform async server-specific create directory commands here. Return true if you executed a server-specific command.

public virtual Task<bool> CreateDirectoryAsync(AsyncFtpClient client, string path, string ftppath, bool force, CancellationToken token)

Parameters

client AsyncFtpClient
path string
ftppath string
force bool
token CancellationToken

Returns

Task<bool>

DefaultCapabilities()

Return your FTP server's default capabilities. Used if your server does not broadcast its capabilities using the FEAT command.

public virtual string[] DefaultCapabilities()

Returns

string[]

DeleteDirectory(FtpClient, string, string, bool, FtpListOption)

Perform server-specific delete directory commands here. Return true if you executed a server-specific command.

public virtual bool DeleteDirectory(FtpClient client, string path, string ftppath, bool deleteContents, FtpListOption options)

Parameters

client FtpClient
path string
ftppath string
deleteContents bool
options FtpListOption

Returns

bool

DeleteDirectoryAsync(AsyncFtpClient, string, string, bool, FtpListOption, CancellationToken)

Perform async server-specific delete directory commands here. Return true if you executed a server-specific command.

public virtual Task<bool> DeleteDirectoryAsync(AsyncFtpClient client, string path, string ftppath, bool deleteContents, FtpListOption options, CancellationToken token)

Parameters

client AsyncFtpClient
path string
ftppath string
deleteContents bool
options FtpListOption
token CancellationToken

Returns

Task<bool>

DetectBySyst(string)

Return true if your server is detected by the given SYST response message. Its a fallback method if the server did not send an identifying welcome message.

public virtual bool DetectBySyst(string message)

Parameters

message string

Returns

bool

DetectByWelcome(string)

Return true if your server is detected by the given FTP server welcome message.

public virtual bool DetectByWelcome(string message)

Parameters

message string

Returns

bool

DontUseMdtmEvenIfCapable(string)

Disable MDTM command even if server says it is supported

public virtual bool DontUseMdtmEvenIfCapable(string path)

Parameters

path string

Returns

bool

DontUseSizeEvenIfCapable(string)

Disable SIZE command even if server says it is supported

public virtual bool DontUseSizeEvenIfCapable(string path)

Parameters

path string

Returns

bool

FileExists(FtpClient, string)

Check for existence of a file Return null indicates custom code decided not to handle this

public virtual bool? FileExists(FtpClient client, string path)

Parameters

client FtpClient
path string

Returns

bool?

FileExistsAsync(AsyncFtpClient, string, CancellationToken)

Check for existence of a file Return null indicates custom code decided not to handle this

public virtual Task<bool?> FileExistsAsync(AsyncFtpClient client, string path, CancellationToken token)

Parameters

client AsyncFtpClient
path string
token CancellationToken

Returns

Task<bool?>

GetAbsoluteDir(FtpClient, string)

Perform server-specific path modification here. Return the absolute dir.

public virtual string GetAbsoluteDir(FtpClient client, string path)

Parameters

client FtpClient
path string

Returns

string

GetAbsoluteDirAsync(AsyncFtpClient, string, CancellationToken)

Perform server-specific path modification here. Return the absolute path.

public virtual Task<string> GetAbsoluteDirAsync(AsyncFtpClient client, string path, CancellationToken token)

Parameters

client AsyncFtpClient
path string
token CancellationToken

Returns

Task<string>

GetAbsoluteFilePath(FtpClient, string, string)

Perform server-specific path modification here. Return concatenation of path and filename

public virtual string GetAbsoluteFilePath(FtpClient client, string path, string fileName)

Parameters

client FtpClient
path string
fileName string

Returns

string

GetAbsoluteFilePathAsync(AsyncFtpClient, string, string, CancellationToken)

Perform server-specific path modification here. Return concatenation of path and filename

public virtual Task<string> GetAbsoluteFilePathAsync(AsyncFtpClient client, string path, string fileName, CancellationToken token)

Parameters

client AsyncFtpClient
path string
fileName string
token CancellationToken

Returns

Task<string>

GetAbsolutePath(FtpClient, string)

Perform server-specific path modification here. Return the absolute path.

public virtual string GetAbsolutePath(FtpClient client, string path)

Parameters

client FtpClient
path string

Returns

string

GetAbsolutePathAsync(AsyncFtpClient, string, CancellationToken)

Perform server-specific path modification here. Return the absolute path.

public virtual Task<string> GetAbsolutePathAsync(AsyncFtpClient client, string path, CancellationToken token)

Parameters

client AsyncFtpClient
path string
token CancellationToken

Returns

Task<string>

GetFileSize(FtpClient, string)

Perform server-specific file size fetching commands here. Return the file size in bytes.

public virtual long GetFileSize(FtpClient client, string path)

Parameters

client FtpClient
path string

Returns

long

GetFileSizeAsync(AsyncFtpClient, string, CancellationToken)

Perform server-specific file size fetching commands here. Return the file size in bytes.

public virtual Task<long> GetFileSizeAsync(AsyncFtpClient client, string path, CancellationToken token)

Parameters

client AsyncFtpClient
path string
token CancellationToken

Returns

Task<long>

GetParser()

Return the default file listing parser to be used with your FTP server.

public virtual FtpParser GetParser()

Returns

FtpParser

IsAbsolutePath(string)

Return true if the path is an absolute path according to your server's convention.

public virtual bool IsAbsolutePath(string path)

Parameters

path string

Returns

bool

IsCustomCalculateFullFtpPath()

Return true if your server requires custom handling to handle listing analysis.

public virtual bool IsCustomCalculateFullFtpPath()

Returns

bool

IsCustomFileExists()

Return true if your server requires custom handling to check file existence.

public virtual bool IsCustomFileExists()

Returns

bool

IsCustomFileSize()

Return true if your server requires custom handling of file size.

public virtual bool IsCustomFileSize()

Returns

bool

IsCustomGetAbsoluteDir()

Return true if your server requires custom handling of absolute dir.

public virtual bool IsCustomGetAbsoluteDir()

Returns

bool

IsCustomGetAbsoluteFilePath()

Return true if your server requires custom handling of path and filename concatenation.

public virtual bool IsCustomGetAbsoluteFilePath()

Returns

bool

IsCustomGetAbsolutePath()

Return true if your server requires custom handling of absolute paths.

public virtual bool IsCustomGetAbsolutePath()

Returns

bool

IsRoot(BaseFtpClient, string)

Check if the given path is a root directory on your FTP server. If you are unsure, return false.

public virtual bool IsRoot(BaseFtpClient client, string path)

Parameters

client BaseFtpClient
path string

Returns

bool

RecursiveList()

Detect if your FTP server supports the recursive LIST command (LIST -R). If you know for sure that this is supported, return true here.

public virtual bool RecursiveList()

Returns

bool

SkipParserErrorReport()

Skip reporting a parser error

public virtual bool SkipParserErrorReport()

Returns

bool

ToEnum()

Return the FtpServer enum value corresponding to your server, or Unknown if its a custom implementation.

public virtual FtpServer ToEnum()

Returns

FtpServer