Skip to content

rybert79/transfer_file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

File Transfer with Resume Support

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.

Features

  • 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

How It Works

Server

The server:

  1. Scans the database folder for available files.
  2. Sends the file list to connected clients.
  3. Receives the client's file selection.
  4. Sends the original file size.
  5. Checks whether the client wants a new download or a resumed download.
  6. Transfers the requested file.

Client

The client:

  1. Connects to the server.
  2. Receives and displays the available file list.
  3. Lets the user choose a file.
  4. Checks whether a partial file already exists locally.
  5. Requests a new download or resumes an interrupted one.
  6. Saves the received data to disk.

Resume Download Mechanism

If a file already exists but is incomplete:

  1. The client checks the current local file size.
  2. The client sends its current byte offset to the server.
  3. The server seeks directly to that offset using:
file.seek(offset)
  1. The server sends only the remaining data.

This avoids restarting the download from the beginning.

Project Structure

project/
│
├── server.py
├── client.py
└── database/
    ├── file1.zip
    ├── file2.pdf
    └── ...

Requirements

  • Python 3.8+

  • Standard Python libraries only:

    • socket
    • threading
    • os
    • sys

No third-party packages are required.

Running the Server

python server.py

The server will start listening on:

localhost:5000

Running the Client

python client.py

The client will connect to the server and display the available files.

Example Workflow

Server Started
    ↓
Client Connects
    ↓
Server Sends File List
    ↓
Client Chooses File
    ↓
Server Sends File Size
    ↓
Client Selects Download Mode
    ↓
Server Transfers File
    ↓
Download Complete

Learning Objectives

This project was created to practice:

  • Socket programming
  • Client-server communication
  • Threading
  • Binary file handling
  • File transfer protocols
  • Resume download techniques

Future Improvements

  • Download progress bar
  • File upload support
  • Transfer speed display
  • SHA256 file integrity verification
  • Multiple simultaneous downloads
  • GUI version

License

This project is intended for educational and learning purposes.

About

Python socket-based file transfer application with resume download support.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages