A lightweight, concurrent file transfer server with a web interface.
This project demonstrates a Python-based concurrent file server (TCP) alongside a Flask web frontend that lists available files and lets users download them through the web UI. The server handles multiple concurrent transfers using worker threads and provides monitoring via the dashboard.
Key features
- Concurrent file transfers using threads.
- Simple TCP-based file transfer server for client downloads.
- Flask-based web interface with:
- File listing (
/api/available-files) - HTTP download endpoint (
/api/download/<filename>) - Dashboard (
/dashboard) showing server stats - Download page (
/download) with streaming download support and progress UI
- File listing (
- Uploads directory (
uploads/) as the source for available files
run_server.py– Main entrypoint: sets up Flask app, a background file server, and sample files.config.py– Configuration values such asUPLOAD_FOLDER, ports, and buffer sizes.server/– Contains the concurrent file server implementation:file_server.py– TCP server that accepts client connections and spawns handlers.file_handler.py– Thread class that streams files to connected TCP clients.
templates/– Jinja2 templates for web pages (index, dashboard, download, base).static/– CSS and JS used by the frontend.uploads/– Directory where files to serve/download are stored.
- Create and activate a virtual environment (recommended):
python3 -m venv venv
source venv/bin/activate- Install dependencies:
pip install -r requirements.txtFrom the project root, run:
python3 run_server.py- The Flask web UI will be available at
http://localhost:5000by default. - The background file server listens on the TCP port configured in
config.py(default8888).
Notes:
- The web UI lists files from the
uploads/folder. The app will createuploads/and some sample files at first run. - The download page uses an HTTP streaming
fetchrequest to/api/download/<filename>to provide a browser-friendly download and progress UI.
- Open the dashboard:
http://localhost:5000/dashboardto view server status and active transfers. - Open the download page:
http://localhost:5000/downloadto see available files and download them. - API endpoints useful for automation or debugging:
GET /api/available-files— returns a JSON list of files available for download.GET /api/download/<filename>— returns the file as an attachment (used by the web UI).GET /api/server-status— returns server runtime stats.
ModuleNotFoundError: No module named 'flask'— ensure the virtual environment is activated and dependencies are installed (pip install -r requirements.txt).- Files not appearing in the UI:
- Confirm files exist under the
uploads/directory. - Confirm
config.pysetsUPLOAD_FOLDER = 'uploads'(relative path from the project root). - Confirm the Flask app is running and reachable at
http://localhost:5000.
- Confirm files exist under the
- The project provides a small
ConcurrentFileServer(TCP) for client-style transfers and a Flask app for browser interactions. The two servers run concurrently: the background TCP server onConfig.PORTand Flask onConfig.WEB_PORT. - The frontend was updated to use HTTP streaming for browser downloads (instead of WebSocket), which is compatible with the Flask
send_fileroute.
Contributions are welcome. Please open an issue or submit a pull request with a clear description of the change.
This project is provided under the MIT License — see LICENSE for details.
- Project created/maintained by Sandipta Saha (Sourav).