Real-time road traffic management system built with Java sockets. A TCP server holds the Valais road network and computes shortest routes via Dijkstra; a terminal client lets drivers request routes and report live travel times.
- Java 21+
- Maven 3.9+
mvn packageProduces two jars in target/:
| File | Purpose |
|---|---|
javamaps-server.jar |
Server (plain jar, no dependencies) |
javamaps-client.jar |
Client (fat jar — JLine bundled) |
Start the server first:
java -jar target/javamaps-server.jarThe server loads valais.csv and listens on port 8888.
Then start the client (in a separate terminal):
java -jar target/javamaps-client.jarUse the arrow keys to select cities. Press Enter to confirm. In environments without raw terminal support (e.g. IDE consoles) the client falls back to a numbered list.
=== JavaMaps ===
1) Find a route
2) Report traffic
3) Quit
- Find a route — select departure and destination; the server returns the fastest path and ETA in minutes.
- Report traffic — select the road segment you just drove and enter how many minutes it took. The server updates the live weight for all future route requests.
Communication uses a line-based text protocol over TCP (pipe-separated fields). See PROTOCOL.md for the full specification.
mvn testsrc/
├── main/java/
│ ├── client/ # Client app and terminal UI
│ ├── common/ # Shared protocol constants
│ └── server/ # Server app, routing engine, TCP layer
└── test/java/
└── server/ # Unit tests (Dijkstra, command factory)