Demonstrates the OTP actor wrapper (gftp/actor) for safe concurrent FTP operations with message-based streaming.
- Connects to an FTP server and wraps the client in an OTP actor
- Logs in, prints working directory, and lists files
- Uploads a file using
open_stor(message-based streaming) - Demonstrates chunk protection: shows that control commands return
DataTransferInProgresswhile a data channel is open - Downloads the file using
open_retrwith aprocess.Selectorreceive loop - Cleans up and disconnects
To quickly spin up a local FTP server using Docker:
docker run -d --name gftp-test-ftp \
-e "USERS=test|test|/home/test" \
-e ADDRESS=127.0.0.1 \
-e MIN_PORT=21100 \
-e MAX_PORT=21110 \
-p 2121:21 \
-p 21100-21110:21100-21110 \
delfer/alpine-ftp-server:latestThen run the client with the appropriate environment variables:
FTP_HOST=127.0.0.1 FTP_PORT=2121 FTP_USER=test FTP_PASSWORD=test gleam run