Listeners are the component in FtpServer which is responsible for listening on the network socket and when clients connect create the user session, execute commands and so on. An FtpServer can have multiple listeners at the same time, some examples include:
- one listener on port 21 (the default option)
- one cleartext listener on port 21 and one for implicit SSL on port 22
- one cleartext listener in an internal IP address only and one for implicit SSL for the external IP address
Listeners are identified by a name, the default listener is identified by "default".
The main network configuration is performed on the listeners, for example the port to listen on and SSL configuration.
Configuration
- config
- listeners
- <listener name>
- class (org.apache.ftpserver.listener.mina.MinaListener)
- address (<none>)
- port (21)
- implicit-ssl (false)
- ssl
- data-connection
- class (<none>)
- idle-time (10)
- active
- enable (true)
- local-address (<none>)
- local-port (0)
- ip-check (false)
- passive
- address (<none>)
- ports (0)
- ssl
| Configuration Parameter |
Description |
| config.listeners.<listener name>.class |
The listener class
- org.apache.ftpserver.listener.mina.MinaListener : High performance listener using asyncronous IO. Requires Java 5
- org.apache.ftpserver.listener.io.IOListener : Listener using blocking IO. Requires Java 1.4
|
| config.listeners.<listener name>.address |
FTP server address the listener will bind to |
| config.listeners.<listener name>.port |
FTP server port |
| config.listeners.<listener name>.implicit-ssl |
True if the listener should use implicit SSL |
| config.listeners.<listener name>.ssl |
See TLS/SSL configuration |
| Data connection configuration |
|
| config.listeners.<listener name>.data-connection.class |
Required, no default value, normally set to "org.apache.ftpserver.DefaultDataConnectionConfig" |
| config.listeners.<listener name>.data-connection.idle-time |
Maximum data connection idle time in second. 0 means no limit. The default value is 10. |
| config.listeners.<listener name>.data-connection.active.enable |
PORT data connection enabled. The default value is true. |
| config.listeners.<listener name>.data-connection.active.local-address |
The localhost address used when local port specified in active data transfer. |
| config.listeners.<listener name>.data-connection.active.local-port |
The local port to be used during active data transfer. According to the specifications, it should be 20. The default value is 0. It means that any free port will be used. |
| config.listeners.<listener name>.data-connection.active.ip-check |
Check the PORT IP with the client IP. The default value is false. |
| config.listeners.<listener name>.data-connection.passive.address |
FTP passive (PASV) address The default value is localhost. |
| config.listeners.<listener name>.data-connection.passive.ports |
See FtpServer Configure passive ports |
| config.listeners.<listener name>.data-connection.ssl |
See TLS/SSL configuration |
Examples
Change the listener port
One internal and one external listener
Use the blocking IO listener
Supporting SSL