A small Python client-server project that demonstrates remote application distribution and updates over TCP sockets. The server keeps a catalog of available application files, clients can list and download them, and a publisher script can push new versions to clients that previously downloaded an app.
This project is intended as a networking and systems-programming demo. It does not include authentication, authorization, or transport encryption, so it should only be used on a trusted local network or in a controlled lab environment.
- Concurrent TCP server that handles multiple clients with threads.
- Simple JSON header protocol with optional binary file payloads.
- Client commands for listing, downloading, running, stopping, checking, and reading logs for demo apps.
- Publisher workflow for releasing a new app version to the server.
- Automatic update push to connected clients that previously downloaded the app.
- Pending update handling when a client is currently running the app.
- Docker Compose support for running the server in a container.
- Python 3.11+
- Python standard library only:
socket,threading,json,subprocess,pathlib - Docker and Docker Compose for optional containerized server runs
.
|-- client.py # Interactive client CLI
|-- common.py # Shared framing/protocol helpers
|-- publisher.py # Publishes a new app version to the server
|-- reset_demo.py # Resets generated demo app state
|-- server.py # Concurrent TCP update server
|-- Dockerfile # Container image for the server
|-- docker-compose.yml # Local server container configuration
|-- new_versions/ # Example app versions for publishing
`-- server_apps/ # Seed apps and server version metadata
Runtime state is written to client_data/ and server_apps/downloads.json; these files are intentionally ignored by Git.
- Python 3.11 or newer
- Docker Desktop or Docker Engine, only if you want to use the containerized server
No third-party Python packages are required.
Create and activate a virtual environment if you want an isolated Python interpreter:
python -m venv .venv
source .venv/bin/activateOn Windows PowerShell:
python -m venv .venv
.\.venv\Scripts\Activate.ps1Start the server:
python server.py 127.0.0.1 5000In another terminal, start a client:
python client.py client-a 127.0.0.1 5000Inside the client prompt, try:
list
download app1.py
run app1.py
status
logs app1.py
stop app1.py
quit
Publish a newer version from another terminal:
python publisher.py app1.py new_versions/app1_v2.py 127.0.0.1 5000If the client downloaded app1.py, the server sends the update automatically. If the app is running, the client stores the update in client_data/<client-id>/pending/ and applies it after the app stops.
Reset the demo state:
python reset_demo.pyBuild and start the server container:
docker compose up --buildThe compose file maps host port 8709 to container port 5000, so a local client can connect with:
python client.py client-a 127.0.0.1 8709| Variable | Used by | Default | Description |
|---|---|---|---|
APPS_DIR |
server.py |
./server_apps |
Directory containing server-side app files and version metadata. |
server_apps/app1.pyandserver_apps/app2.pyare seed demo apps.new_versions/app1_v2.pyandnew_versions/app1_v3.pyare sample payloads for testing updates.server_apps/downloads.jsontracks which clients downloaded each app during a run and should not be committed.client_data/contains local client state, downloaded apps, pending updates, and logs and should not be committed.
This project is a learning/demo implementation. Before using the design beyond a local lab, add authentication, authorization, TLS, input validation, app integrity checks, and a safer deployment model.