Tagged: Acces Point, AP, esp32, FTP
- This topic has 27 replies, 7 voices, and was last updated 2 years, 4 months ago by
avateur.
-
AuthorPosts
-
-
4 September 2020 at 23:19 #6094
Kemran D.
Hi, how can i turn wifi station mode to the wifi acces point mode? İ want to connect to the esp8266 and then upload file with FtpServer.
-
5 September 2020 at 07:28 #6095
Hi Kemran,
yes, It’s possible, I attach a simple sketch that do this work.
Respect the code from the article
FTP server on esp8266 and esp32
I add this part
// 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);
Attachments:
You must be logged in to view attached files. -
5 September 2020 at 10:40 #6098
Kemran D.
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?
-
5 September 2020 at 10:52 #6099
Download attached file, there is the complete sketch.
Bye Renzo
-
5 September 2020 at 11:04 #6100
Kemran D.
İ copied this part from complete sketch. My question is that should i remove part which is i added above to add your acces point part?
-
5 September 2020 at 21:43 #6103
No no don’t worry the sketch is ready, but I check and I post an esp32 version, here the esp8266 version
Attachments:
You must be logged in to view attached files. -
6 September 2020 at 20:30 #6108
Hi Renzo,
İ 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.
Kemran D.
-
6 September 2020 at 20:31 #6109
-
6 September 2020 at 20:34 #6111
-
6 September 2020 at 23:25 #6113
Hi Kemran,
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..Bye Renzo
-
22 November 2021 at 13:42 #16493
Hi Renzo,
Congratulations on the work.I tried to run the sketch as an attachment (FTP via Access Point) but I couldn’t access the files and I got the following message:
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!!
Thank you for your attention.
-
9 December 2021 at 10:05 #16960
I have the same problem.
I use your code with SD card
and I do this:
#ifndef DEFAULT_FTP_SERVER_NETWORK_TYPE_ESP32
#define DEFAULT_FTP_SERVER_NETWORK_TYPE_ESP32 NETWORK_ESP32
#define DEFAULT_STORAGE_TYPE_ESP32 STORAGE_SD
#endif
-
-
9 December 2021 at 10:19 #16961
Hi,
i tried it now and it worked correctly.Try to format SD again and write and read something before start server FTP.
Give me some other information like the console output of compiling time.
Bye Renzo
-
9 December 2021 at 11:29 #16962
-
-
9 December 2021 at 11:41 #16964
Hi,
please add the information I had requested.
Bye Renzo -
22 June 2022 at 12:04 #21462
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.Cheers, LuÃs Pereira.
Attachments:
You must be logged in to view attached files. -
22 June 2022 at 13:49 #21466
(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.Cheers, LuÃs Pereira.
Attachments:
You must be logged in to view attached files. -
26 June 2022 at 18:18 #21495
Hi,
the problem is this:Response: 227 Entering Passive Mode (0,0,0,0,195,89)
you must specify the address because for some reason It can’t find the self-IP address.
Try to usevoid setLocalIp(IPAddress localIp);
to sed the IP.
Bye Renzo -
27 June 2022 at 00:13 #21510
Hi,
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 linelocalIp = 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 afterlocalIp = NET_CLASS.localIP();
I placedlocalIp=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.
Cheers, LuÃs Pereira.
-
28 June 2022 at 09:49 #21515
Hi Luis,
I do some tests, and AP mode worked without problem, I attach an example.
Can you verify and give me feedback?
Thanks, RenzoAttachments:
You must be logged in to view attached files. -
14 September 2022 at 01:38 #22921
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
-
16 September 2022 at 08:27 #22939
Hi nicoxx,
from the log you send me/**************************/ Command is: PASV Connection management set to passive Listening at 0.0.0.0:50009 -M-L-S-D- /**************************/
It seems that the IP you passed to the server was wrong, and It set 0.0.0.0.
Bye Renzo
-
-
20 September 2022 at 14:27 #22987
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-
20 September 2022 at 22:33 #23008
Hi nicoxx,
your reply went to spam, I restored It.I have added a new version that tries to fix this problem, if you can give me feedback.
Bye Renzo
-
-
29 January 2023 at 22:01 #24069
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
-
-
AuthorPosts
- You must be logged in to reply to this topic.