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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started