How frozsgy/ceng435-hw works
Project Type and Purpose
• This is a client/server file‐transfer application written in Python, implementing a reliable data transfer (RDT) protocol (similar to RDT 3.0) on top of UDP and also supporting TCP.
• Purpose: transfer arbitrary files reliably over an unreliable network channel by exchanging packets with checksums and acknowledgments.
File Structure
• Top-level scripts:
• client.py – the client executable
• server.py – the server executable
• Shared modules:
• packet.py – defines packet structure, serialization, checksum logic
• util.py – helper methods (e.g., file I/O, timeout logic, argument parsing)
• simulator/ – (optional) code for running or testing simulated networks
• No separate “frontend” or “backend” directories; the architecture is a two-node network system.
Key Components
a. Client Application
– “Command‐Line Interface” (parses args)
– “File I/O Module” (reads input file, writes received data)
– “RDT Layer” (maintains send buffer, sequence numbers, ACK list)
– “Packet Module” (builds packets: data, id, checksum)
– “Transport Layer” (selects UDP or TCP socket)
b. Server Application
– “Transport Layer” (listens on UDP/TCP ports)
– “Packet Module” (parses incoming packets, validates checksum)
– “RDT Layer” (tracks received packet IDs, generates ACKs)
– “File I/O Module” (writes complete file to disk)
c. Network Channel
– “UDP Unreliable Channel”
– “TCP Reliable Channel”
– (Optionally) a simulated network behavior from simulator/
d. External Environment
– Underlying OS socket API
– File system
Relationships and Data Flows
• Client → (open socket) → Network Transport
• Network Transport → (segment or datagram) → Server
• Server → (ACK packet) → Client
• Within each node, data flows top-down: CLI → File I/O → RDT → Packet → Transport
• RDT sits logically between application logic (file I/O) and transport (UDP/TCP)
Architectural Patterns and Principles
• Layered architecture:
1. Application Layer (file operations, user interface)
2. RDT Layer (reliability, sequence numbers, ACKs)
3. Transport Layer (sockets over UDP/TCP)
• Single responsibility per module: packet.py handles packet concerns, util.py handles helpers.
Critical Elements
• Application logic
• Reliability layer
• Transport layer
• File system
• Call out Python’s socket API as the underlying mechanism