Question
The assignment should be implemented in Java . Utilization of technologies such as RMI and JMS are not allowed . Problem Description Using a client-server
The assignment should be implemented in Java. Utilization of technologies such as RMI and JMS are not allowed.
Problem Description
Using a client-server architecture, design and implement a multi-threaded server that allows concurrent clients to search the meaning(s) of a word, add a new word, and remove an existing word.
- Sockets
- Threads
Hence, the assignment must make an EXPLICIT use of the two above. By explicit, we mean that in your application, sockets and threads must be the lowest level of abstraction for network communication and concurrency.
Architecture
- The system will follow a client-server architecture in which multiple clients can connect to a (single) multi-threaded server and perform operations concurrently.
- The multi-threaded server may implement a thread-per-request, thread-per-connection, or worker pool architecture. This is a design decision for you to make.
Interaction
- All communication will take place via sockets. These sockets can be either TCP or UDP, however, keep in mind that all communication between clients and server is required to be reliable.
- You are responsible for designing your own message exchange protocol. Some data formats that you may use include XML, JSON, Java Object Serialization, or you may choose to design your own.
Failure Model
- All communication between components has to be reliable. If you are using TCP, then the reliability guarantees offered by the protocol are sufficient. If you decide to use UDP, then you have to implement an infrastructure that offers reliable communication over UDP. For those of you with previous experience using TCP, using UDP may be a rewarding challenge.
- It is expected that, on both the server and the client side, errors (by means of exception handling) are properly managed. The errors include the following:
- Input from the console for what concerns the parameters passed as command line.
- Network communication (address not reachable, bad data...).
- I/O to and from disk (cannot find the dictionary file, error reading the file, etc...).
- Other errors you might come up with.
The application will be tested and validated against all these errors.
Functional Requirements
- Query the meaning(s) of a given word
The client should implement a function that is used to query the dictionary with the following minimum (additional input/output parameters can be used as required) input and output:
Input: Word to search
Output: Meaning(s) of the word
Error: The client should clearly indicate if the word was not found or if an error occurred. In case of an error, a suitable description of the error should be given to the user.
- Add a new word
Add a new word and one or more of its meanings to the dictionary. For the word to be added successfully it should not exist already in the dictionary. Also, attempting to add a word without an associated meaning should result in an error. A new word added by one client should be visible to all other clients of the dictionary server. The minimum input and output parameters are as follows:
Input: Word to add, meaning(s)
Output: Status of the operation (e.g., success, duplicate)
Error: The user should be informed if any errors occurred while performing the operation.
- Remove an existing word
Remove a word and all of its associated meanings from the dictionary. A word deleted by one client should not be visible to any of the clients of the dictionary server. If the word does not exist in the dictionary then no action should be taken. The minimum input and output parameters are as follows:
Input: Word to remove
Output: Status of the operation (e.g., success, not found)
Error: The user should be informed if any errors occurred while performing the operation.
User Interface
A Graphical User Interface (GUI) is required for this project. You are free to design it and to use any existing tools and libraries for this purpose.
Implementation Guidelines
These are guidelines only, you are allowed and encouraged to come up with your own design and interfaces.
- When the server is launched, it loads the dictionary data from a file containing the initial list of words and their meanings. These data is maintained in memory in a structure that enables an efficient word search. When words are added or removed, the data structure is updated to reflect the changes.
- sample command to start the server is:
> java jar DictionaryServer.jar
Where
- When the client is launched, it creates a TCP socket bound to the server address and port number. This socket remains open for the duration of the client-server interaction. All messages are sent/received through this socket.
- sample command to start the client is:
> java jar DictionaryClient.jar
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started