Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java progarm please need help greatly appreacite it =) COP-4338 Programming III, Summer 2018 Programming Assignment 1: Multi-threading & Internet Networking in Java Due Date:
Java progarm please need help greatly appreacite it =)
COP-4338 Programming III, Summer 2018 Programming Assignment 1: Multi-threading & Internet Networking in Java Due Date: May 25 at 11:55 PM In this assignment, you will implement a simple chat room. This will require a server program 1 Problem Specification The server is multi-threaded. It maintains a list (a ArrayList will work well) of all the active connections. It will listen on a port for a new connection. You have the authority to choose the port number and design appropriate protocol for client-server communication. When one comes in, it spawns a thread to handle the connection, and the main thread resumes listening The spawned thread sends out a message asking for an ID name on the socket. When the client replies, the connection information is added to the master list of chat room occupants (so there is a shared ArrayList of Print Writer references). From that point on, anything that is typed by the client is relayed to all chat room occupants (including the client), with the ID identifying the client. Of course if null is read from the client, or the special value LOGOUT then the client has disconnected and you should remove the connection from the shared ArrayList and then exit the thread gracefully (i.e. stop the infinite loop in the run method). Don't worry too much about error checking. However, you will need to be careful to synchronize access to the array list using locks, since otherwise you might delete an entry while another thread is trying to broadcast to everyone, potentially resulting in an out-of- bounds ArrayList access or worse. You can test the server by starting it and connecting via several telnet windows. (You can turn the echo on for the telnet windows to see what you are typing.) COP-4338 Programming III, Summer 2018 Programming Assignment 1: Multi-threading & Internet Networking in Java Due Date: May 25 at 11:55 PM In this assignment, you will implement a simple chat room. This will require a server program 1 Problem Specification The server is multi-threaded. It maintains a list (a ArrayList will work well) of all the active connections. It will listen on a port for a new connection. You have the authority to choose the port number and design appropriate protocol for client-server communication. When one comes in, it spawns a thread to handle the connection, and the main thread resumes listening The spawned thread sends out a message asking for an ID name on the socket. When the client replies, the connection information is added to the master list of chat room occupants (so there is a shared ArrayList of Print Writer references). From that point on, anything that is typed by the client is relayed to all chat room occupants (including the client), with the ID identifying the client. Of course if null is read from the client, or the special value LOGOUT then the client has disconnected and you should remove the connection from the shared ArrayList and then exit the thread gracefully (i.e. stop the infinite loop in the run method). Don't worry too much about error checking. However, you will need to be careful to synchronize access to the array list using locks, since otherwise you might delete an entry while another thread is trying to broadcast to everyone, potentially resulting in an out-of- bounds ArrayList access or worse. You can test the server by starting it and connecting via several telnet windows. (You can turn the echo on for the telnet windows to see what you are typing.)
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