FTP Server

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
Roberthh
Posts: 778
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: FTP Server

Post by Roberthh » Wed Nov 09, 2016 5:37 pm

Hello @warren, thanks for testing. I can fix the passive mode glitch. But I do not know how to stop the device listening on both interfaces.
If I start the server before activating the station mode, it tells me to listen on the AP_IF. It later gives no new messages, until I restart it. But that is not required. You can leave it active in the background. I have attached a version which at least tell you which ip adress it' s going to use for passive mode transfers. You may have a look at it, and I dig further.
uftpd.zip
(4.16 KiB) Downloaded 17 times

User avatar
Roberthh
Posts: 778
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: FTP Server

Post by Roberthh » Wed Nov 09, 2016 8:03 pm

Hello @warren. I think I have a fix now. The server now sets the IP address for passive mode data transfers according to the IP address of the incoming call. As a hint: besides FileZilla you may also use the Ubuntu file manager, like nautilus, for access. Just select: goto server and enter
ftp://x.x.x.x. Here is the zip file. The content is again on the github site too.
uftpd.zip
(11.3 KiB) Downloaded 58 times
P.S.: I did some cooking in between, which gave me time for thinking & better ideas
P.P.S: If you use command line ftp, you can use rstat to see, which IP addresses are used.

warren
Posts: 73
Joined: Tue Jul 12, 2016 5:47 pm

Re: FTP Server

Post by warren » Thu Nov 10, 2016 12:38 pm

Roberthh wrote:Hello @warren. I think I have a fix now.
Thank you for this new version Robert. - It works perfectly!

Thinking about it, in my application, there is a potentially an advantage in having it respond to both interfaces....

Thanks too for the Nautilus tip - also very useful!

User avatar
Roberthh
Posts: 778
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: FTP Server

Post by Roberthh » Thu Nov 02, 2017 8:18 pm

After using it for a year now, I added some functions from the ESP8266 ft server to the simple variant, which runs in foreground and works both on ESP8266 and the ESP32 port. I added active mode and a few command variants used by Windows machines. Now it supports Windows command line ftp, and allows also to access files on the device out of the Windows explorer. You can connect it using ftp://ip_address in the target line of Explorer. Operations supported are file listing, copying files in and out, and deleting files. Windows Explorer does not tell always the server, when it's closed, so the ftpserver may seem to be locked. In that case you can stop it with Ctrl-C in the terminal window.

The place to get is is as always https://github.com/robert-hh/ESP8266-FTP-Server

bitninja
Posts: 63
Joined: Thu Sep 15, 2016 4:09 pm

Re: FTP Server

Post by bitninja » Tue Nov 07, 2017 11:19 pm

First of all... thanks everyone for all the work... I find it runs very well indeed.

I did have one question about using the ftp.py application though. From what I understand it is like a one-shot run of the FTP server and then it quits when the connection is closed. The question I had was, what would be the simplest way to put a *time limit* on how long it waits for a connection. I would like to run it for like a minute, and then if there are no connections... exit quietly.

In my amateurish attempts to achieve this, the easiest way I found was to simply give the ftpsocket as specific timeout. Then trap the timeout with a exit from the main "forever" loop. It works, but I'm not sure it's the best way to do it.

User avatar
Roberthh
Posts: 778
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: FTP Server

Post by Roberthh » Wed Nov 08, 2017 6:09 am

Thanks a lot. And yes, the timeout mechanism you describe looks like a suitable implementation. If it works, you're right. The try/except mechanism of python is made for situations like that, intended and unintended specific conditions.

Post Reply