Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java: Create a multi-threaded phone server, where the processing of each incoming request will take place inside a separate thread of execution. Client.java 1. Request

Java: Create a multi-threaded phone server, where the processing of each incoming request will take place inside a separate thread of execution.

Client.java

1. Request a connection with the server

2.Send three types of messages through established connection:

STORE messages containing name and phone number

GET messages containing requests for phone number

REMOVE messages containing requests to remove a number from the list

Server.java

1. Accept requested connections and support multiple connections

2. Maintain an appropriate data structure (a list) that holds data received from a client. The data stored on server is a list of names and phone numbers which is empty at startup. It is not persistent.

3. Process messages received from the client:

If message is STORE with a pair of name and number, server will have to update the list of phone numbers

If the message is GET with a request (a name as a content), the server has to send to the client the phone number of this name stored in the list.

If message is REMOVE with a name, server has to remove this name and number associated with this name from the list.

If there is an erroneous message, server should react by sending an appropriate message to the client

Clients are Java console applications that start with a connection request to the server.

Server is also a Java console application that starts with an empty list of names and phone numbers.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

10. Disagrees, shows passive rejection, formality, withholds help

Answered: 1 week ago

Question

6. Explain the power of labels.

Answered: 1 week ago

Question

5. Give examples of variations in contextual rules.

Answered: 1 week ago

Question

f. What stereotypes were reinforced in the commercials?

Answered: 1 week ago