Question: Give me java code for client, server, multithreadserver, and readme file. No AI - generated code, please. the server must allow multiple clients connect the
Give me java code for client, server, multithreadserver, and readme file. No AIgenerated code, please. the server must allow multiple clients connect the server at the same time. You are required to implement a multithreaded server using PthreadC Thread or Java thread and a client that can monitor the servers message and the users input at the same time eg using select or threads Besides the original five commands ADD, DELETE, LIST, SHUDOWN, QUIT, you will need to implement five new commands, LOGIN, LOGOUT, WHO, LOOK, UPDATE, on the client side and the corresponding functions on the server side. Note: all users share the same address book. The details of the protocol depend on the command the client sends to the server. LOGIN Identify the user to the remote server. A client that wants to login should begin by sending the ASCII string LOGIN followed by a space, followed by a UserID, followed by a space, followed by a Password, and followed by the newline character ie
Your server should be initialized with the UserIDs and Passwords of at least four users who will be allowed to execute the ADD, DELETE, UPDATE, and SHUTDOWN the root user only commands at the server. However, a user is allowed to execute the LIST, WHO, LOOK, and QUIT commands anonymously without login When the server receives a LOGIN command from a client, it should check if the UserID and Password are correct and match each other. If they are not correct or dont match each other, the server should return the string Wrong UserID or Password, otherwise it should return the OK message. A clientserver interaction with the LOGIN command thus looks like: c: LOGIN john john s: OK LOGOUT Logout from the server. A user is not allowed to send ADD, DELETE, and SHUTDOWN commands after logout but it can still send LIST, LOOK, WHO, and QUIT commands. A clientserver interaction with the LOGOUT command looks like: c: LOGOUT s: OK WHO List all active users, including the UserID and the users IP addresses. A clientserver interaction with the WHO command thus looks like: c: WHO s: OK The list of the active users: john root LOOK Look up a name in the book. Display the complete name and phone number record. A client sends the ASCII string LOOK followed by a space, followed by a number look for the first name, look for the last name, look for the phone number followed by a name or a phone number, and followed by the newline character ie
When the server receives a LOOK command from a client, it will look up the name or the phone number in the address book. When there is a match, it returns the OK message and all the matched record s If there is no match, it returns the Your search did not match any records A clientserver interaction with the LOOK command thus looks like: c: LOOK Miller s: OK Found match David Miller John Miller c: LOOK s: Your search did not match any records UPDATE Update an existing record in the book and display the updated record. A client sends the ASCII string UPDATE followed by a space, followed by a Record ID followed by a number update the first name, update the last name, update the phone number followed by a name or a phone number, and followed by the newline character ie
The client should then wait for the server to return a OK message indicating that the record is successfully updated and followed the updated record, or a The Record ID does not exist." A clientserver interaction with the UPDATE command thus looks like: c: UPDATE Smich s: OK Record updated David Smith c: UPDATE s: OK Record updated David Smith c: UPDATE John s: The Record ID does not exist. ADD and DELETE The basic requirement is the same as the assignment except that a user needs to login first to execute these commands. If a user has not logged in the server will return a You are not currently logged in login first" message LIST Same as the assignment SHUTDOWN The basic requirement is the same as the assignment except that only the root user can execute this command. When your server receives a SHUTDOWN command from a client, it should check if the current user is the root. If it is not the root user, the server should return a User not allowed to execute this command" message. In addition, the SHUTDOWN will make all clients and the server terminate. A clientserver interaction with the SHUTDOWN command thus looks like: c: SHUTDOWN s: OK At the windows of all clients s: the server is about to shutdown QUIT If a user logged in from the current client, QUIT also logout the user. Note, a user can execute WHO, LIST, and QUIT commands before loggedin
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
