nailbuster / esp8266FTPServer

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

TCP connection is dropped by server just after STOR issued #33

Open Jahencov opened 4 years ago

Jahencov commented 4 years ago

I'm using this FTP server in my ESP826 project. I have found that it is very unstable to send some files to server. Based on Wireshark logs TCP connection is dropped after STOR operation: Debug shows on ESP: "ftpdataserver client...." Client (FileZilla): " Command: STOR esp8266-template.cfg Response: 425 No data connection "

I have fixed it with following change in FtpServer::dataConnect() (code attached below): 1) "data.stop()" commented 2) "data.available()" or-ed in return

Not sure if it is best solution, however after this changes files transfers works stable at every time.

Regards, Bruno

" boolean FtpServer::dataConnect() { unsigned long startTime = millis(); //wait 5 seconds for a data connection if (!data.connected()) { while (!dataServer.hasClient() && millis() - startTime < 10000) { //delay(100); yield(); } if (dataServer.hasClient()) { //data.stop(); data = dataServer.available();

ifdef FTP_DEBUG

          Serial.println("ftpdataserver client....");
        #endif

  }

}

return data.connected() || data.available();

} "