Write a chat application that allows multiple clients to participate in a simultaneous text chat. General guidelines for the project are

The first thing you will need to do is to construct a transcript class to represent the conversation. You should store the transcript as a list of strings. Each time a comment comes in from a client that comment will get added as a new string at the end of the transcript list.

As is usual for servers, you will be creating a task object running in a thread to manage the interaction with each client. Each time a comment arrives the thread will call an appropriate method in the transcript class to have that comment added to the transcript.

On the client side you should set up a proxy class with the following interface:

public class ChatGateway
{
	public void startChat(String handle) {}
	public void sendComment(String comment) {}
	public int getCommentCount() {}
	public String getComment(int n) {}
}

To handle fetching comments from the server, you should set up a thread in the client that wakes up, say, twice every second and checks for new comments:

while(true) {
  if(gateway.getCommentCount() > count)
		// Fetch new comments and put them in the text area
	
	try {
	  Thread.sleep(500);
	} catch(InterruptedException ex) {
	  // Fail silently
	}
}

The thread code contains an infinite loop. On each trip through the loop, the code will go to the gateway and check to see what the comment count is now. If the gateway tells you that more comments are available than you have downloaded, go back to the gateway to get the new comments and append them to the text area that shows the transcript. After doing this, the thread code goes to sleep for 500 milliseconds. After it wakes up from that sleep is goes back through the loop again.