Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write in Java. Also please don't copy and paste answers already on Chegg as I find them unhelpful. Thank you. :) Server Part: 1.

Please write in Java. Also please don't copy and paste answers already on Chegg as I find them unhelpful. Thank you. :)

Server Part:

1. Create a PrintServer.java Class

Hint: two useful packages that you can import to your code:

i. java.io,

ii. Java.net

2. Two private member, int Port, and int MaxConnections which is the max number of clients that can connect to the server.

3. Set MaxConnections to 5. After the server has provided service to MaxConnections clients, the server prints The highest possible number of connections has already been reached. Please come back at a later time. on the screen and exits.

4. Listen for socket connection requests

5. Accept a clients connection

6. Send and receive messages from each client (Bi-direction or duplex)

Client Part:

- Client.java

- PrintClient.java

- TestClient.java

Hint: three useful packages that you can import to your code:

i. java.io,

ii. java.net,

iii. java.util.

PrintClient class:

1. One private member: String host

2. A new constructor to initiate the host, and the parents variable: the port

3. Connect to server

4. Handle connections by sending and receiving messages

TestClient class:

5. test your methods in PrintClient class about sending and receiving messages from the server.

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_2

Step: 3

blur-text-image_3

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

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions

Question

What cells in the blood act as a host for HIV?

Answered: 1 week ago

Question

5. Discuss the key roles for training professionals.

Answered: 1 week ago