diff options
author | Daniel Plasa <dplasa@gmail.com> | 2020-05-26 04:56:07 +0200 |
---|---|---|
committer | Daniel Plasa <dplasa@gmail.com> | 2020-05-26 04:56:07 +0200 |
commit | 863ff54097231ceae6e34908d843586adc83a44d (patch) | |
tree | 28d5d8cefb34c55c1b56f3e573052bcc02ea04ce | |
parent | try subtile malloc()'ing buffers with 16 byte steps until we get something (diff) | |
download | FTPCLientServer-863ff54097231ceae6e34908d843586adc83a44d.tar FTPCLientServer-863ff54097231ceae6e34908d843586adc83a44d.tar.gz FTPCLientServer-863ff54097231ceae6e34908d843586adc83a44d.tar.bz2 FTPCLientServer-863ff54097231ceae6e34908d843586adc83a44d.tar.lz FTPCLientServer-863ff54097231ceae6e34908d843586adc83a44d.tar.xz FTPCLientServer-863ff54097231ceae6e34908d843586adc83a44d.tar.zst FTPCLientServer-863ff54097231ceae6e34908d843586adc83a44d.zip |
-rw-r--r-- | README.md | 52 | ||||
-rw-r--r-- | espFtpServer.cpp | 6 | ||||
-rw-r--r-- | espFtpServer.h | 2 | ||||
-rw-r--r-- | library.properties | 2 |
4 files changed, 37 insertions, 25 deletions
@@ -1,29 +1,41 @@ -# esp8266FTPServer -Simple FTP Server for using esp8266/esp32 SPIFFs -I've modified a FTP server from arduino/wifi shield to work with esp8266/esp32 +# espFTPServer +Simple FTP Server for using esp8266/esp32 +I've modified a FTP server from arduino/wifi shield to work with the esp826. It should also work on the esp32. LittleFS with directory handling is supported since SPIFFS has been marked deprecated. +This allows you to FTP into your esp8266/esp32 and access/modify the LittleFS/SPIFFS folder/data. +I've tested it with Filezilla, and it works (upload/download/rename/delete). There's no create/modify directory support in SPIFFS but in LittleFS there is! -It should support esp32 and is also using LittleFS as SPIFFS has become deprecated. -Use -```cpp -#define esp8266FTPServer_SPIFFS -#include <esp8266FTPServer.h> -``` -to switch back to SPIFFS, if you need to. +## Features +* Supports active and passive FTP +* Works with LittleFS and SPIFFS +* Supports Directories in LittleFS -This allows you to FTP into your esp8266/esp32 and access/modify the LittleFS/SPIFFS folder/data...it only allows one ftp connection at a time....very simple for now... +## Limitations +* It only allows one ftp control and one data connection at a time. You need to setup Filezilla (or other clients) to respect that, i.e. only allow **1** connection. (In FileZilla go to File/Site Manager then select your site. In Transfer Settings, check "Limit number of simultaneous connections" and set the maximum to 1.) +* It does not support encryption, so you'll have to disable any form of encryption... -I've tested it with Filezilla, and the basics work (upload/download/rename/delete). There's no create/modify directory support in SPIFFS but in LittleFS there is! +## Useage -You need to setup Filezilla (or other client) to only allow **1** connection.. -To force FileZilla to use the primary connection for data transfers: -Go to File/Site Manager then select your site. -In Transfer Settings, check "Limit number of simultaneous connections" and set the maximum to 1 +### Construct an espFTPServer +Select the desired FS via the contructor +```cpp +#include <espFTPServer.h> +#include <LittleFS.h> -It also only supports Passive ftp mode. +espFTPServer ftpServer(LittleFS); // construct with LittleFS +// or +espFTPServer ftpServer(SPIFFS); // construct with SPIFFS if you need to for backward compatibility +``` -It does NOT support any encryption, so you'll have to disable any form of encryption... +### Configure username/password +```cpp +ftpServer.begin("username", "password"); +``` -feel free to try it out (sample provided)....unzip into your arduino library directory (and restart arduino ide). +### Handle by calling frequently +```cpp +ftpServer.handleFtp(); // place this in e.g. loop() +``` -this is the original project on github I worked from: https://github.com/gallegojm/Arduino-Ftp-Server/tree/master/FtpServer +## Notes +I forked from https://github.com/nailbuster/esp8266FTPServer which itself was forked from: https://github.com/gallegojm/Arduino-Ftp-Server/tree/master/FtpServer
\ No newline at end of file diff --git a/espFtpServer.cpp b/espFtpServer.cpp index a6c705f..aa67fe3 100644 --- a/espFtpServer.cpp +++ b/espFtpServer.cpp @@ -1030,9 +1030,9 @@ int32_t FtpServer::allocateBuffer(int32_t desiredBytes) if (maxBlock - desiredBytes < 0) desiredBytes = maxBlock; - // leave at least (10% of heap) as reserve - if (maxHeap - desiredBytes < (maxHeap / 10)) - desiredBytes -= (maxHeap / 10); + // leave at least (20% of heap) as reserve + if (maxHeap - desiredBytes < (maxHeap / 5)) + desiredBytes -= (maxHeap / 5); // round down on 4byte bound desiredBytes &= ~3; diff --git a/espFtpServer.h b/espFtpServer.h index 2f3e329..a9f8d56 100644 --- a/espFtpServer.h +++ b/espFtpServer.h @@ -51,7 +51,7 @@ #define FTP_DEBUG_MSG(...) #endif -#define FTP_SERVER_VERSION "0.9-20200525" +#define FTP_SERVER_VERSION "0.9.2-20200526" #define FTP_CTRL_PORT 21 // Command port on wich server is listening #define FTP_DATA_PORT_PASV 50009 // Data port in passive mode diff --git a/library.properties b/library.properties index 419d1fd..335af06 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=espFtpServer -version=0.9.1 +version=0.9.2 author=Daniel Plasa maintainer=dplasa@gmail.com sentence=Simple FTP server for SPIFFS and LittleFS on esp8266/esp32 |