// Connect to Wi-Fi network with SSID and password
Serial.print("Setting AP (Access Point)…");
// Remove the password parameter, if you want the AP (Access Point) to be open
WiFi.softAP(ssid, password);
IPAddress IP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(IP);
Thank you for your reply Renzo, Did you remove this
WiFi.begin(ssid, password);
Serial.println("");
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
part of the code? Or just added access point part? Actually which part of code you removed
and where actually added acces point part?
İ tested code which is above and there is a problem. İ uploded your code to my esp8266 nodemcu and then connected to the access point with my laptop. After all this wanted to connect with filezilla to the ftp server. Every time when i wanted to connect to the ftp server i got an errorors like “Connection closedby server” or “Could not connect to server”. 1.jpg is filizilla error and 2.jpg is serial monitor in esp8266 side. İ’am using esp8266 nodemcu V3 with 4MB flash. Do you have an idea ? İ actually stuck and dont know what to do. İ appreciate your reply.
Second image. İf you need more information i can screenshot and upload. My boards cpu is 80MHz, may be its not enough for Acces point and ftp server at same time.
It’s strange I repeat test with my WeMos D1 mini and works correctly
AP IP address: 192.168.4.1
SPIFFS opened!
Ftp server waiting for connection on port 21
Client connected!
USER esp8266
PASS esp8266
OK. Waiting for commands.
CWD /
PWD
TYPE I
PASV
Connection management set to passive
Data port set to 50009
MLSD
ftpdataserver client....
TYPE A
PASV
Connection management set to passive
Data port set to 50009
STOR wp-signup.php
ftpdataserver client....
Receiving wp-signup.php
Check if you are doing all steps to configure FileZilla..
and try to give better power supply..
Hi
Has anyone managed to have Esp32 with Access point+FTP on SD card storage?
I have been using Esp32 with STA mode+FTP on SD card storage for a while, and it works perfectly both ways (upload, download), but now I need to do it in AP mode, and aparently there is a problem with fetching the SD file list after the connection is made, while on STA mode Filezilla prints this after connection:
Status: Connecting to 192.168.1.107:21...
Status: Connection established, waiting for welcome message...
Status: Plain FTP is insecure. Please switch to FTP over TLS.
Status: Logged in
Status: Retrieving directory listing...
Status: Directory listing of "/" successful
Status: Retrieving directory listing of "/"...
Status: Directory listing of "/" successful
On the AP mode Filezilla prints this:
Status: Connecting to 192.168.4.1:21...
Status: Connection established, waiting for welcome message...
Status: Plain FTP is insecure. Please switch to FTP over TLS.
Status: Logged in
Status: Retrieving directory listing...
Command: PWD
Response: 257 "/" is your current directory
Command: TYPE I
Response: 200 TYPE is now 8-bit binary
Command: PASV
Response: 227 Entering Passive Mode (0,0,0,0,195,89)
Command: MLSD
Error: The data connection could not be established: WSAEADDRNOTAVAIL - Cannot assign requested address
Response: 425 No data connection
Error: Failed to retrieve directory listing
I’m sending the code I’m using for both STA or AP mode, depending onthe commented section on the setup(). Also, I’m using arduino IDE 1.8.19 and esp32 board version 2.0.3.
STA and AP code attached.
Can anyone give me a haned please, any tips are welcome.
Thank you.
(Not sure why but my post disappeared after editing, sorry in advance if this results in duplicated post)
Hi
Has anyone managed to have Esp32 with Access point+FTP on SD card storage?
I have been using Esp32 with STA mode+FTP on SD card storage for a while, and it works perfectly both ways (upload, download), but now I need to do it in AP mode, and aparently there is a problem with fetching the SD file list after the connection is made, while on STA mode Filezilla prints this after connection:
Status: Connecting to 192.168.1.107:21...
Status: Connection established, waiting for welcome message...
Status: Plain FTP is insecure. Please switch to FTP over TLS.
Status: Logged in
Status: Retrieving directory listing...
Status: Directory listing of "/" successful
Status: Retrieving directory listing of "/"...
Status: Directory listing of "/" successful
On the AP mode Filezilla prints this:
Status: Connecting to 192.168.4.1:21...
Status: Connection established, waiting for welcome message...
Status: Plain FTP is insecure. Please switch to FTP over TLS.
Status: Logged in
Status: Retrieving directory listing...
Command: PWD
Response: 257 "/" is your current directory
Command: TYPE I
Response: 200 TYPE is now 8-bit binary
Command: PASV
Response: 227 Entering Passive Mode (0,0,0,0,195,89)
Command: MLSD
Error: The data connection could not be established: WSAEADDRNOTAVAIL - Cannot assign requested address
Response: 425 No data connection
Error: Failed to retrieve directory listing
On the serial monitor on arduino IDE, from boot and connection start I get:
ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13516
load:0x40080400,len:3604
entry 0x400805f0
Set AP named:ESP32
AP IP address: 192.168.4.1
Card Mount Successful.
SD opened!
Listing directory: /
DIR : System Volume Information
DIR : Data
FILE: .dropbox.device SIZE: 56
FILE: Backup_dongle.txt SIZE: 370
FILE: settings.txt SIZE: 368
NOT ANONYMOUS
esp32
Ftp server waiting for connection on port 21
Client connected!
>>>>>>>>>>>>>>> _callback 0 1 1
CONNECTED
-U-S-E-R- -e-s-p-3-2-
-
Command is: USER
USER: esp32 esp32
-P-A-S-S- -e-s-p-3-2-
-
Command is: PASS
Authentication Ok. Waiting for commands.
-O-P-T-S- -U-T-F-8- -O-N-
-
Command is: OPTS
200 OK, UTF8 ON
-P-W-D-
-
Command is: PWD
-T-Y-P-E- -I-
-
Command is: TYPE
-P-A-S-V-
-
Command is: PASV
Connection management set to passive
Listening at 0.0.0.0:50009
-M-L-S-D-
-
Command is: MLSD
List of file!!
I’m sending the code I’m using for both STA or AP mode, depending onthe commented section on the setup(). Also, I’m using arduino IDE 1.8.19 and esp32 board version 2.0.3.
STA and AP code attached.
Can anyone give me a haned please, any tips are welcome.
Thank you.
First of all, thank you very much for your quick response.
The setLocalIp function placed before or after the server begin did not solve it, in the end I noticed that on FtpServer.cpp on line localIp = NET_CLASS.localIP(); always set the local IP to 0.0.0.0, as if the setLocalIp made no diference…not sure why, doesn’t make sense. So I forced it, right after localIp = NET_CLASS.localIP(); I placed localIp=IPAddress (192, 168, 4, 1); and that solved it in a very dirty way.
To make it STA and AP proof, In FtpServer.h I changed the function begin to: begin( const char * _user, const char * _pass, bool AP=false ,const char * welcomeMessage = "Welcome to Simply FTP server");
, and in FtpServer.cpp changed: localIp = NET_CLASS.localIP(); toif(!AP)localIp = NET_CLASS.localIP();else localIp=WiFi.softAPIP();.
This way the FTP server works on both STA and AP now, just passing true or false on the server.begin.
Surely the fix did not require all this trouble but I just couldn’t figure out why the setLocalIp wasn’t doing the job =\
Anyway, it’s solved somehow, thank you very much for your help and libraries.
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:
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).
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.
Hi Renzo. Thanks for the use of your library. I’m testing your Esp32 AP_FFAT sketch.
I’m a very basic coder so bear with me. I tried to modify the sketch to use SD card.
I’m able to connect to the server and directory listing says successful but the sd card is not displayed in the right hand window.
I can confirm sd card is working fine with another server in station mode. Do you have
a sketch for AP mode already configured for SD card as I figure my mod may not be up to par.
Thanks.
Filezilla:
Connecting to 192.168.4.1:21…
Status: Connection established, waiting for welcome message…
Status: Insecure server, it does not support FTP over TLS.
Status: Server does not support non-ASCII characters.
Status: Logged in
Status: Retrieving directory listing of “/”…
Status: Directory listing of “/” successful
Maintaining a repository (or site or forum) is a lot like tending to a garden - it requires constant care and attention to keep it thriving. If you're a skilled gardener (or coder!) and want to help keep our repository blooming, we'd love to have you on board! We're also looking for talented writers and forum moderators to help us grow our community. Interested in joining our team? Don't hesitate to reach out and let us know how you can contribute!
Are you a fan of electronics or programming? Share your knowledge with others, write a simple tutorial or how to make a great project Contact me: share_your_ideas@mischianti.org
The content displayed on this website is protected under a CC BY-NC-ND license. Visitors are prohibited from using, redistributing, or altering any content from this website for commercial purposes, including generating revenue through advertising. Any unauthorized use is a violation of the license terms and legal action may be taken against individuals or entities found to be in violation.
You must also provide the link to the source.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.