void fnStartFtp(
unsigned short usFTPTimeout,
unsigned char ucFTP_operating_mode);
usFTPTimeout is the FTP connection idle timeout period in seconds. This allows a period of 1 to 65'534s (18.2 hours) to be specified.
0xffff (
INFINITE_TIMEOUT) will set an infinite time (no timeout).
The value 0 should not be used!
ucFTP_operating_mode supports the following values
FTP_AUTHENTICATE {require authentication rather than accepting anonymous login - requires project option FTP_USER_LOGIN}
0 {accept anonymous login}
fnStartFtp is called to start the µTasker FTP server. The FTP server will listen on port 21 (
FTP_CONTROL_PORT).
The function doesn't return a result since it will always start the server as long as a there exists a free TCP socket in the TCP socket pool
[2 sockets are always automatically reserved for FTP use {control and data sockets} - see
#define FTP_SOCKETS 2 in
config.h].
If the server has already been started previously a second start will be ignored and thus disturb.
Project options
The following defines can be set on a project basis (
config.h) to configure the capabilities of the FTP server:
FILE_NAMES_PER_FTP_FRAME 6 {limit size of buffers required to display files to this many names (remove to use maximum possible)}
FTP_SOCKETS 2 {reserve 2 TCP sockets for command and data}
FTP_SUPPORTS_NAME_DISPLAY {show details of files in client}
FTP_SUPPORTS_DELETE {enable delete of files via FTP (overwrites are still possible without this)}
FTP_SUPPORTS_DOWNLOAD {support read of files via FTP (uploads are still possible without this)}
FTP_VERIFY_DATA_PORT {check for valid data port when in active mode (avoid accepting DOS FTP IP 0,0,0,0 on port 0)}
FTP_PASV_SUPPORT {allow passive mode of operation (otherwise only active)}
FTP_WILDCARD_DEL {*.* deletes complete file system content}
DATA_PORT_TRIGGERS_CONTROL {activity on the FTP data port resets the control port TCP idle timer - stops control connection timing out on large data transfers with short idle time value}
FTP_USER_LOGIN {enable authentication login support}
Examples
fnStartFtp((2*60), 0); // start FTP server with amonymous login and idle timeout of 2 minutes
fnStartFtp(INFINITE_TIMEOUT, FTP_AUTHENTICATE); // start FTP server with no idle timeout and require user authentication
Related functions
fnStopFtp();
For more details about the use of the µTasker FTP server see the document
µTasker FTP.
Please use the
µTasker forum to ask specific questions.