Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • nicoxx
    Participant

      Hi Renzo
      yes, seems that the IP address the FTP class uses is wrong.

      As I wrote, my esp32 is used in AP mode only.
      I configured the network with default IP address (192.168.4.1), gateway and subnet mask.
      I have a web server on the esp32 that works normally.
      I tryed to pass the right IP address to the ftp server, but with no results (ftpSrv.setLocalIp(softAPIP());

      I tryed just after the server begin and also just after the event of the first client is connected to esp32 AP WiFi. I tryed also passing to ftpSrv.setLocalIp() the corrected IP address as constant.

      In my opinion the two function softAPIP() and localIP() act differently in AP mode and in STA mode.

      The ftp server private variable localIp is initialized using localIP() and that (for some reasons) lead to localIp == 0.0.0.0.

      Even if the code use setLocalIp() after ftp begin, this is not used because at runtime, entering PASV mode, the code detect a 0.0.0.0 in localIp and try to obtain the correct IP, but always using localIP(), overwrinting user-assigned IP and obtaining again 0.0.0.0.

      At this point, using softAPIP() instead, the ftp server can report the correct IP.

      In my opinion, a possible solution can be to act differently in STA mode and in AP mode, in a similar way as used in https://github.com/me-no-dev/ESPAsyncWebServer#using-filters; I used this feature in order to have two different web page accessing the esp32 from the AP or from the STA.

      The two ‘filters’ are two functions that can be found in
      https://github.com/me-no-dev/ESPAsyncWebServer/blob/master/src/WebServer.cpp at row 24
      At this link
      bye

      nicoxx
      Participant

        Dear Renzo; I’m using your last version of ftp library on esp32 with last arduino core and last stable arduino IDE. I’m having the same problem described here and on your github forum. my code, as regards wifi section, is similar to your last example here. ESP32 is in AP only mode. activating lib debug message, last part is exactly:

        /**************************/
        Command is: PASV
        Connection management set to passive
        Listening at 0.0.0.0:50009
        -M-L-S-D-
        /**************************/

        reading here, I understand that the problem was solved, but in order to have a client connection from filezilla on win10, I had to modify FtpServer.cpp at row 497 (of last available version on github), as:

        /**************************/
        .
        .
        .
        //
        // PASV – Passive Connection management
        //
        else if( CommandIs( “PASV” ))
        {
        data.stop();
        dataServer.begin();
        if (((((uint32_t) NET_CLASS.localIP()) & ((uint32_t) NET_CLASS.subnetMask())) ==
        (((uint32_t) client.remoteIP()) & ((uint32_t) NET_CLASS.subnetMask()))) && (uint32_t)localIp <= 0) {
        dataIp = NET_CLASS.softAPIP(); //NET_CLASS.localIP(); //<– LD
        } else {
        dataIp = localIp;
        }
        dataPort = pasvPort;
        DEBUG_PRINTLN( F(” Connection management set to passive”) );
        .
        .
        .
        /**************************/

        replacing call to NET_CLASS.localIP() with a call to NET_CLASS.softAPIP()

        with this replacement, the connection in fine&fast.
        I tryed to use ftpSrv.setLocalIp(), with actual IP address, when the first wifi client connect to esp32 AP time after esp32 boot, but with no results. I have not tested the code with esp32 in STA mode.

        just for information, I had some trial with few android ftp client app, but with no luck. some app have trouble in entering PASV mode, some have trouble with SYST and another have trouble with file path (adding a strange ./ in the middle of the file path, just before file name. the app is working with a filezilla server).

        regards

      Viewing 2 posts - 1 through 2 (of 2 total)