Skip to content

Custom Servers

Robin Rodricks edited this page Oct 12, 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. If your FTP server outputs file listings in a non-standard manner, you can implement a custom listing parsing method and then set that method on client.ListingCustomParser (example).
  4. Call client.Connect() and then use FTP methods as usual
  5. Viola!

Extendable handlers

Your class that extends from FluentFTP.Servers.FtpBaseServer supports these extendable handlers, so that you can implement server-specific behaviour.

All of these are optional. You only need to implement the ones you want and the non-implemented ones will automatically fallback to default handling.

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