nailbuster / esp8266FTPServer

Simple FTP Server for using esp8266/esp32 SPIFFs
GNU Lesser General Public License v2.1
209 stars 126 forks source link

Prevent disconnect before file is fully received #20

Closed sandtec65 closed 6 years ago

sandtec65 commented 6 years ago

In the doStore function, the data.available return value may be less than the complete file size, if all tcp packets have not been received when the call is made. The problem is then that closeTransfer() will be called regardless, i.e. before the entire file is received, and the transfer will be interrupted. The code changes will allow additional doStore() iterations before closeTransfer is called. Tested OK on both ESP32 and ESP8266. Note: on ESP32, use arduino lib newer than 10 july, 2018.