The tcFtpd class is used to launch a simple FTP server. A configuration structure of type tcFtpdConfig, is passed in to configure the server. The root directory, username/password, priority of the client and server threads, and the number of simultaneous clients are all configurable.
Only the rudimentary FTP commands are supported, including: "CWD", "DELE", "LIST", "MKD", "XMKD", "NLST", "NOOP", "PASS", "PASV", "PORT", "PWD", "XPWD", "QUIT", "RETR", "RMD", "XRMD", "RNFR", "RNTO", "STOR", "SYST", "TYPE", "USER"
This is a simple example of tcFtpd creation and usage:
{ static char root[] = "C:"; static char user[] = "Fred"; static char pass[] = "flintstone"; tcFtpd *MyClass::mpFtpServer; tcFtpdConfig ftpConfig; ... // create FAT filesystem C partition buffer[0] = 'C'; buffer[1] = 0; rv = RegisterFATDriver((RAWREAD)tcDspStorageBase::readDispatch, (RAWWRITE)tcDspStorageBase::writeDispatch, (GETTIME)TimeCallback, &device, buffer, (void *)mpDevice); // start network lwip_stack_init(); // configure server ftpConfig.mpRootDir = root; ftpConfig.mpUsername = user; ftpConfig.mpPassword = pass; ftpConfig.mnMaxClients = 1; // launch server mpFtpServer = new tcFtpd(&ftpConfig); ... }