Skip to content

Custom Servers

Robinicks edited this page Mar 29, 2020 · 13 revisions

Overview

FluentFTP supports many server types out-of-the-box. However if your company or your hardware is running a non-standard FTP server that does not properly support the FTP protocol, you can customize FluentFTP to work with it. FluentFTP has a variety of properties that let you configure its behavior (check the feature pages for relevant properties).

FluentFTP also has a flexible server system. All server-specific routines for standard FTP servers are implemented in a classes extending from FluentFTP.Servers.FtpBaseServer. Therefore to support a non-standard server you can simply create a class in your project extending this base class and add your custom handling routines in there.

Steps

  1. Create a new class extending FluentFTP.Servers.FtpBaseServer. Lets call it YourFtpServer. For examples you can look here.
  2. After creating your FtpClient set client.ServerHandler = new YourFtpServer(); . Make sure you do this before you Connect() to the server.
  3. For implementing custom directory parser refer to this old example.
  4. Call client.Connect() and then use FTP methods as normal
  5. Viola!

Extendable handlers

You can handle the following features in a server-specific manner:

Method Description Used for
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. Improving performance of LIST command
DefaultCapabilities Return your FTP server's default capabilities. Used if your server does not broadcast its capabilities using the FEAT command. Getting server capabilities
IsAbsolutePath Return true if the path is an absolute path according to your server's convention. Supporting weird path formats
GetParser Return the default file listing parser to be used with your FTP server. Parsing directory listings
DeleteDirectory Perform server-specific delete directory commands here. Return true if you executed a server-specific command. Improving performance of DeleteDirectory
DeleteDirectoryAsync Perform async server-specific delete directory commands here. Return true if you executed a server-specific command. Improving performance of DeleteDirectory
CreateDirectory Perform server-specific create directory commands here. Return true if you executed a server-specific command. Improving performance of CreateDirectory
CreateDirectoryAsync Perform async server-specific create directory commands here. Return true if you executed a server-specific command. Improving performance of CreateDirectory
Clone this wiki locally