关于后端:KIT318云计算大数据

51次阅读

共计 4305 个字符,预计需要花费 11 分钟才能阅读完成。

KIT318: Big Data and Cloud Computing Assignment 1 – Multithreaded Chat Server
Maximum Marks (10%), Individual Assignment.
Problem Description
Using a client-server architecture, design and implement a multi-threaded server that enables chat between clients.
This assignment has been designed to demonstrate the usage of the two fundamental technologies that have been discussed during the lectures:

Sockets
Threads

Hence, the assignment must make an EXPLICIT use of the two above. By explicit, I mean that in your application Sockets and Threads must be the lowest level of abstraction for network communication and concurrency.

Implementation Guidelines
Design two components:
Multithreaded Chat server: It allows one to one chat between two users and blocks any profane chat.
A client: it is used by the user to interact with chat server and other users.

Level 1 Implementation (4 Marks): Client and Server interaction
Chat server (i.e. Multi-Threaded Server) allows multiple clients to connect and interact simultaneously using socket. Server asks each client on connection to send name and short description about himself/herself. Once this is received, server send a welcome message stating that user is registered and list of relevant commands that allow private chat with other clients. At least following command should be supported by the server:
a)Help: listing all the commands
b)Listusers: listing all the currently registered (connected) users
c)RequestChat username: send request for chat with another user
d)AcceptChat: accept chat invitation from another user
e)RejectChat: reject the chat invitation from another user
f)ExitChat: disconnect the chat with another user
g)Exit: disconnect from server
At level 1 of implementation, server will receive these commands from the user. Help, Listuser and Exit command should work.

Level 2 Implementation (4 Marks): Chat between users
If server receives a request for chat (e.g. U1), e.g. RequestChat U2. Server will check whether U2 is available to chat i.e. not currently chatting with another user. If U2 is available, server will inform U2 that U1 wants to chat. To accept chat invitation, U2 can type AcceptChat. The server will then send a message“Now you can chat with“XYZ”user”to both the users.
All the messages that any of these users write will be send to the server who will transfer it to the other user. In case any user types ExitChat, the exit chat message is sent to both users.
In case U2 is not available or rejected the invitation , then server will inform U1 accordingly.

Level 3 Implementation (2 Marks): Block profane chats
The server checks whether a chat message contains any bad/profane words. If it contains, then the profane word will be replaced by‘**”. The server also informs the user who wrote the message that chat can be blocked i.e. a warning is issued to prevent such cases.

Other than the above specified implementation, any other details that is required to complete the functionality is left to the student to decide. It is important to notice that the communication has to be RELIABLE. This means that even though both TCP and UDP are allowed for implementing the assignment, in case of the use of UDP it is necessary to provide an infrastructure allowing reliable communication.

Error Handling
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 (broken connection, address not reachable, bad data…)
other errors you might come up with

The application will be tested and validated against all these errors.

Implementation Language
The assignment needs to be implemented in Java. If one wants to use any other programming language, it needs to be discussed with Unit Coordinator on individual level.

It is NOT ALLOWED to use any of the following support libraries or methods: RMI/JMS (Java), but an explicit use of sockets should be made. For concurrency it is EXPECTED to use threads.
Final packaging and delivery
The assignment will consist of AT LEAST two executables (.java files); one for the server and the other for the client. The source code will be submitted with a text file stating your name and student id, and details about how to run the application.
Deadline and Submission

The assignment should be submitted using ASSIGNMENT folder (On Mylo). The deadline for submitting the assignment is: 30 March 2022 11.55pm
You need to give a demonstration to receive the final marks.

Marking Scheme
The marks are given based on successful implementation of above specified functionality. One can get Level 2 implementation marks only when Level 1 implementation is working. Similarly, Level 3 implementation marks are only given if Level 1 and Level 2 are correctly implemented.
Partial marks will be awarded for incomplete functionality implementation only if there is an indication of sincere attempt. The marks awarded will vary from 0% to 80% depending on how a particular feature is implemented.

正文完
 0