Home

Awesome

uftpd: small FTP server for ESP8266, ESP32 and Pyboard D

Intro

Based on the work of chrisgp - Christopher Popp and pfalcon - Paul Sokolovsky Christopher made a first uftp server script, which runs in foreground. Paul made webrepl with the framework for background operations, which then was used also by Christopher to implement his utelnetsever code. My task was to put all these pieces together and assemble this uftpd.py script, which runs in background and acts as ftp server. Due to its size, for ESP8266 it either has to be integrated into the flash image as frozen bytecode, by placing it into the esp8266/modules folder and performing a rebuild, or it must be compiled into bytecode using mpy-cross and loaded as an .mpy file. The frozen bytecode variant is preferred.

Limitations

The server has some limitations:

Start-up

You'll start the server with:

import uftpd

The service will immediately be started at port 21 in silent mode. You may stop the service then with:

uftpd.stop()

When stopped or not started yet, start it manually with:

uftpd.start([port = 21][, verbose = level]) or uftpd.restart([port = 21][, verbose = level])

port is the port number (default 21) verbose controls the level of printed activity messages, values 0 .. 2

You may use uftd.restart([port = 21][, verbose = level]) as a shortcut for uftp.stop() and uftpd.start().

Coverage

The server works well with most dedicated ftp clients, and most browsers and file managers. These are test results with an arbitrary selected set:

Linux

Mac OS X, various Versions

Windows 10 (and Windows XP)

Android

IOS 9.1

Windows 10 mobile

Conclusion: All dedicated ftp clients work fine, and most of the file managers too.

Trouble shooting

The only trouble observed so far was clients not releasing the connections. You may tell by the value of uftp.client_list, which should be empty if no client is connected, or by issuing the command rstat in ftp, which shows the number of connected clients. In that case you may restart the server with uftpd.restart(). If uftd.client_busy is True when no client is connected, then restart the server with with uftpd.restart(). If you want to see what happens at the server, you may set verbose to 2. Just restart it with uftpd.restart(verbose = 1), or set uftpd.verbose_l = 1, and uftpd.verbose_l = 0 to stop control messages again.

Files