This repository now provides a Python implementation of the countdown protocol described in Project 1, Phase 1. The system exposes iterative and concurrent TCP server suites that follow a three-tier design.
src/main/python/countdown/
service.py # Application-tier countdown business logic
common/ # Infrastructure components shared by servers
iterative/ # Iterative server and client implementations
concurrent/ # Concurrent server and client implementations
docs/ # Architecture report and sample output transcripts
All commands assume you are in the repository root, have Python 3.11+, and set PYTHONPATH=src/main/python so the modules can be imported.
Open two terminals.
- Start the server (default host
0.0.0.0, port5000):PYTHONPATH=src/main/python python -m countdown.iterative.server 5000 0.0.0.0
- Run the client with a positive integer argument:
PYTHONPATH=src/main/python python -m countdown.iterative.client 5 localhost 5000
Use --max-clients on the server to exit automatically after serving a fixed number of requests.
- Start the server (default host
0.0.0.0, port5001):PYTHONPATH=src/main/python python -m countdown.concurrent.server 5001 0.0.0.0 --max-workers 4
- Run the client:
PYTHONPATH=src/main/python python -m countdown.concurrent.client 4 localhost 5001
Override host/port as needed. The concurrent server spawns a thread for each client connection (bounded by --max-workers when provided).
Sample command transcripts are stored in docs/sample-output.md and were generated by running the commands above.
- Source code for iterative and concurrent suites (see
src/main/python/countdown). docs/three-tier-architecture.mdsummarises the layered design.docs/sample-output.mdcontains terminal transcripts demonstrating the countdown protocol.