This project implements a client/server model using Java UDP sockets to manage a city council's initiative for reducing private car usage in inner-city areas. Residents are issued membership cards for free or reduced-rate travel on public transport. The system tracks sign-ins and sign-offs at kiosks via a membership card with a client ID and PIN, handling transactions and validations over a UDP network.
- Implement Java UDP networking for concurrent client-server communication.
- Utilize Java Object Serialization/Deserialization for data storage and retrieval.
- Manage file reading and writing for persistent data storage.
- Java Development Kit (JDK) installed on your machine.
- Basic knowledge of UDP networking, serialization/deserialization, and file handling in Java.
- Initializes from a text file (
Member.txt) containing customer records and loads these into an ArrayList. - Handles incoming UDP packets from clients, parsing messages for sign-in, sign-out, and exit actions.
- Performs all necessary validations and updates customer records accordingly.
- Periodically serializes the ArrayList to a binary file (
Member.dat) for data persistence.
- Offers a menu-driven interface for users to sign in, sign out, or exit.
- Sends user actions and credentials to the server via UDP packets.
- Displays responses from the server, including validation messages and errors.
- Implements Serializable interface.
- Contains relevant information such as client ID, PIN, and travel records.
- Manages serialization of customer records from the ArrayList to the binary file
Member.dat.
- Start the Server: Compile and run
UDPServer.java. This initializes the server, loads existing records, and starts listening for UDP requests. - Run the Client Application: Compile and run
UDPClient.javaon the same or a different machine. Follow the on-screen prompts to sign in or sign out.
- The server periodically serializes the customer records to
Member.dat, ensuring data is saved even between server restarts.