A chat or other collaboration server. The application server keeps track of who is signed in to the session, keeps all messages and whenever a user types in a message, broadcasts it to the other people.Instead of creating a text-based chat server we took a more comprehensive approach. We decided to integrate the Java assignments given to this point and create a chat client with a GUI front-end. There is a separate server process that can be run without access to a graphical display, for convenience.If you choose to do a text-based chat, you should implement the standard features of signing in to a chat session, displaying the names of all the people currently logged in to the session, and displaying all the messages. In addition, you should do some additional features (how much depends on whether you're working alone or in a group of two). Additional features could include the capability of subgroups, so that not everyone sees every message; saving the chat session to a file so that you can read the messages later; or only allowing people to login who are validated for the chat (in a separate interface).
The TalkServer application is the back-end server. This server accepts incoming connections, keeps track of the socket connections from each client and relays messages for the clients.
The client GUI is an applet that displays three panes to the user. The first allows the user to enter text to be sent into a scrolling text area. Two buttons below that area direct the completed message to be sent to everyone listening or a selected group.
The user can select a group of recipients for their message in the top-right hand pane. This is the list of people currently connected to the server. The list is automatically updated as people connect and disconnect from the server.
The bottom pane is where messages from others are shown. Messages are
displayed with the user who sent the message on the left and their message
on the right. Message senders are color-coded by the person sending the
message.
The server application TalkServer must be run before client connections can be made. Once your classpath has been set to include the TalkApplet.jar file, you can execute the TalkServer server application. There is one possible command line parameter for the talk server application: the port number you wish to run the server on. Example java TalkServer 25097 will start the server process on port 25097.
From this directory type:
appletviewer NetTalk.html
This will start the applet on your machine.
Once the applet has started select the File->Login menu option. This will display a dialog box into which you need to enter three pieces of information. The first is the name by which you want to be known to others. The second and third are the host on which the desired server is running and the port it is running on. As written, the server defaults to port 25097. However, another port may be specified on the command line.
This applet uses the Swing Extensions to the AWT API. The version of Swing used here is compatible with that is supplied with Java 1.2.