README.md
md1 kBIn final_24_25_1.zip
Exercise 2:
Create a client-server application using TCP sockets in Java where multiple clients can connect to a central server to perform authenticated operations.
Client side:
- The client connects to the server using the server's IP address and port number.
- Upon connection, the client is prompted to enter a username and password.
- If authentication succeeds (based on a predefined user list on the server), the client can issue the following
commands:
- ADD x y → Server returns the sum of x and y.
- MAX x y → Server returns the maximum of x and y.
- BYE → Ends the session.
- The client receives and displays the server's response for each command.
- Invalid commands should return an error message from the server.
Server side:
- Maintains a predefined list of valid usernames and passwords.
- Accepts multiple client connections concurrently using threads.
- Authenticates each client upon connection. If authentication fails, the server sends a rejection message and closes the connection.
- Upon successful login, the server handles commands from the client as described above.
- Closes the connection when the client sends BYE