Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!