Skip to content

mrfisch3r/threaded-mini-ftp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Threaded Mini FTP-like Client/Server (TCP) — Python

A small “FTP-like” learning project built with Python TCP sockets. It supports:

  • get <filename> — download a file from the server
  • upload <filename> — upload a file to the server

The server is multi-client (thread-per-connection). File transfers are done in 1KB chunks.

This is not the real FTP protocol — just a minimal client/server exercise.

Repo layout

client/
  client.py
  sample_upload.txt
server/
  server.py
  sample_download.txt

Requirements

  • Python 3.x
  • Default host/port: 127.0.0.1:5106

Run locally (Windows + PowerShell)

Open three terminals (one server, two clients).

Terminal 1 (server)

cd .\server
python .\server.py

Terminal 2 (client A)

cd .\client
python .\client.py

Terminal 3 (client B) (optional, to test concurrency)

cd .\client
python .\client.py

Try it

In any client window:

ftp> get sample_download.txt
ftp> upload sample_upload.txt
ftp> quit

Output file naming

To avoid overwriting originals, outputs are written as new<Filename> with the first letter capitalized:

  • After get sample_download.txt, the client creates: client\newSample_download.txt
  • After upload sample_upload.txt, the server creates: server\newSample_upload.txt

Verify transfers (optional)

Compare file hashes in PowerShell:

# download check
Get-FileHash .\server\sample_download.txt
Get-FileHash .\client\newSample_download.txt

# upload check
Get-FileHash .\client\sample_upload.txt
Get-FileHash .\server\newSample_upload.txt

Notes / limitations

  • Uses a simple EOF sentinel to mark end-of-file. TCP is a byte stream, so this repo includes a small buffer to reliably detect the marker across recv() calls.
  • A more robust protocol would send the file size (length-prefixed framing) to avoid any chance of the marker appearing inside binary data.

About

Python socket programming project: a multi-client, thread-per-connection TCP file transfer server with a simple CLI client supporting upload/download commands

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages