comp90015 课业解析

  • May 15, 2020

comp90015 课业解析题意:使用客户端-服务器体系结构,设计并实现允许并发的多线程服务器客户端搜索单词的含义,添加新单词,并删除现有单词。解析:使用socket构建一个可以连接多个客户端的多线程服务器,服务器从包含初始列表的文件中加载字典数据单词及其含义,数据在一个能够实现的结构中把存在内存中的高效单词搜索。添加或删除单词,数据结构将更新并反映变化。客户端它会创建绑定到服务器地址和端口的套接字数。此套接字在客户端-服务器交互期间保持打开状态。所有消息通过此套接字发送/接收涉及技术点:socket,java Tcp/Udp套接字编程,GUI界面实现实现代码:进行中。

COMP90015: Distributed Systems – Assignment 1Multi-threaded Dictionary Server (15 marks)Problem DescriptionUsing a client-server architecture, design and implement a multi-threaded server that allows concurrentclients to search the meaning(s) of a word, add a new word, and remove an existing word.This assignment has been designed to demonstrate the use of two fundamental technologies that havebeen discussed during the lectures: Sockets ThreadsHence, the assignment must make an EXPLICIT use of the two above. By explicit, we mean that in yourapplication, sockets and threads must be the lowest level of abstraction for network communication andconcurrency.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, orworker 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 thatyou 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 thereliability guarantees offered by the protocol are sufficient. If you decide to use UDP, then youhave to implement an infrastructure that offers reliable communication over UDP. For those ofyou 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 wordThe client should implement a function that is used to query the dictionary with the followingminimum (additional input/output parameters can be used as required) input and output:Input: Word to searchOutput: Meaning(s) of the wordError: The client should clearly indicate if the word was not found or if an error occurred. In caseof an error, a suitable description of the error should be given to the user. Add a new wordAdd a new word and one or more of its meanings to the dictionary. For the word to be addedsuccessfully it should not exist already in the dictionary. Also, attempting to add a word withoutan associated meaning should result in an error. A new word added by one client should be visibleto all other clients of the dictionary server. The minimum input and output parameters are asfollows: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 wordRemove a word and all of its associated meanings from the dictionary. A word deleted by oneclient should not be visible to any of the clients of the dictionary server. If the word does not existin the dictionary then no action should be taken. The minimum input and output parameters areas follows:Input: Word to removeOutput: Status of the operation (e.g., success, not found)Error: The user should be informed if any errors occurred while performing the operation.User InterfaceA Graphical User Interface (GUI) is required for this project. You are free to design it and to use anyexisting tools and libraries for this purpose.Implementation GuidelinesThese are guidelines only, you are allowed and encouraged to come up with your own design andinterfaces. When the server is launched, it loads the dictionary data from a file containing the initial list ofwords and their meanings. These data is maintained in memory in a structure that enables anefficient word search. When words are added or removed, the data structure is updated toreflect the changes.A sample command to start the server is:> java –jar DictionaryServer.jar Where is the port number where the server will listen for incoming client connectionsand is the path to the file containing the initial dictionary data. When the client is launched, it creates a TCP socket bound to the server address and portnumber. This socket remains open for the duration of the client-server interaction. All messagesare sent/received through this socket.A sample command to start the client is:> java –jar DictionaryClient.jar Implementation LanguageThe assignment should be implemented in Java. Utilization of technologies such as RMI and JMS are notallowed.ReportYou should write a report describing your system and discussing your design choices. Your report shouldinclude: The problem context in which the assignment has been given. A brief description of the components of the system. An overall class design and an interaction diagram. A critical analysis of the work done followed by the conclusions.Please mind that the report is a WRITTEN document, do not put only graphs. A report without anydescriptive text addressing the problem, architecture, protocols, and the analysis of the work done willnot be considered valid.The length of the report is not fixed. A good report is auto-consistent and contains all the requiredinformation for understanding and evaluating the work done. Given the level of complexity of theassignment, a report in the range of 4 to 6 pages is reasonable. Please mind that the length of the reportis simply a guideline to help you in avoiding writing an extremely long or incomplete report.It is important to put your details (name, surname, student id) in: The head page of the report. As a header in each of the files of the software project.This will help to avoid any mistakes in locating the assignment and its components on both sides.SubmissionYou need to submit the following via LMS: Your report in PDF format only. Two executable jar files (DictionaryClient.jar and DictionaryServer.jar) that will be used to runyour system on the day of the demo. Your source files in a .ZIP or .TAR archive only.Submissions will be due on: Thursday 5 of September (5 pm).MarkingThe marking process will be structured by first evaluating whether the assignment (application + report)is compliant with the specification given. This implies the following: Use of TCP/UDP sockets and threads for the application; proper use of concurrency in the server; proper handling of the errors; a report with the requested content and format (PDF); timeliness in submitting the assignment in the proper format (names, directory structure, etc.).All of the above elements will earn you a maximum of 10 (out of 15) marks. The rest of the marks areassigned to two elements: Excellence (3 marks – 2 for implementation, 1 for report). The assignment has not only beenimplemented by meeting the minimum requirements but the design has been well thought and aproper interaction with the user has been provided (notification of errors, which really help tounderstand what went wrong). For what concerns the report excellence, the report is completeand well written with the proper graphs and a discussion and analysis of the system implementedincluding advantages and disadvantages of your design choices. You need to explicitly write inthe Report all Excellence elements (point-by-point listing with brief illustration/discussionincluded) in a separate section. Creativity (2 marks). Any additional implementation such as a GUI for managing the server orother enhancements to the code introducing advanced features (such as processing of userrequests within a server in scalable, reliable, and efficient manner) will be considered a plus. Forexample, using your own implementation of a thread pool (not Java’s) would earn you thesemarks. You need to explicitly write in the Report all Creativity elements (point-by-point listingwith brief illustration/discussion included) in a separate section.NOTE 1 (EXTREMELY IMPORTANT): The excellence and the creativity marks (5 marks) cannotcompensate any lack in the first part (the one that scores up to 10 marks). Please concentrateyour efforts in getting the first 10 marks done and then proceed with the rest.Note 2: Don’t document anything you haven’t implemented in the report. This is misconduct and willresult in severe penalties.Demonstration Schedule and VenueYou are required to provide a demonstration of the working application and will have the opportunity todiscuss with the tutors the design and implementation choices made during the demo.You are free to develop your system where you are more comfortable (at home, on one pc, on your laptop,in the labs…) but keep in mind that the assignment is meant to be a distributed system that works on atleast two different machines in order to separate the client from the server.We will announce the demo date, time, and venue closer to the due date. Each tutor will hold 2-3 demosessions and you will be required to showcase your system in one of the sessions held by the tutor of theworkshop in which you are enrolled.If you need any clarification on the assignment, kindly ask questions during the tutorials or in the LMSforum, so that all students benefit from it.Note: You need to submit a printed copy of your report during the demonstration.Penalties for late submissions of assignmentsAssignments submitted late will be penalized in the following way: 1 day late: -1 mark 2 days late: -3 marks (-1 – 2) 3 days late: -6 marks (-3 – 3) 4 days late: -10 marks (-6 – 4) etc.