A simple client-server file transfer application built with Python sockets. This project allows clients to download files from a server and supports resuming interrupted downloads.
- Download files from a server
- Dynamic file listing from the server database
- Multi-client support using threading
- Resume interrupted downloads
- Automatic file size synchronization
- Binary file transfer support
- Simple command-line interface
The server:
- Scans the
databasefolder for available files. - Sends the file list to connected clients.
- Receives the client's file selection.
- Sends the original file size.
- Checks whether the client wants a new download or a resumed download.
- Transfers the requested file.
The client:
- Connects to the server.
- Receives and displays the available file list.
- Lets the user choose a file.
- Checks whether a partial file already exists locally.
- Requests a new download or resumes an interrupted one.
- Saves the received data to disk.
If a file already exists but is incomplete:
- The client checks the current local file size.
- The client sends its current byte offset to the server.
- The server seeks directly to that offset using:
file.seek(offset)- The server sends only the remaining data.
This avoids restarting the download from the beginning.
project/
│
├── server.py
├── client.py
└── database/
├── file1.zip
├── file2.pdf
└── ...
-
Python 3.8+
-
Standard Python libraries only:
- socket
- threading
- os
- sys
No third-party packages are required.
python server.pyThe server will start listening on:
localhost:5000
python client.pyThe client will connect to the server and display the available files.
Server Started
↓
Client Connects
↓
Server Sends File List
↓
Client Chooses File
↓
Server Sends File Size
↓
Client Selects Download Mode
↓
Server Transfers File
↓
Download Complete
This project was created to practice:
- Socket programming
- Client-server communication
- Threading
- Binary file handling
- File transfer protocols
- Resume download techniques
- Download progress bar
- File upload support
- Transfer speed display
- SHA256 file integrity verification
- Multiple simultaneous downloads
- GUI version
This project is intended for educational and learning purposes.