Server Specifications

The Qchat server is a text mode Java application. Unlike a Java applet, it is capable of file access which is very important since the server has to interface with the CGI programs. One of the server's tasks is to manage numerous client connections. This includes deciding which clients should receive which messages, sending data to other connected servers, and so on. Since management of local and remote users is quite different, we will discuss them separately. There are also two types of channels that exist, permanent and temporary. When a server is started, it will read a file which contains a list of channel names. These channels are permanent and will always be available, even if there is no one using them. Temporary channels are created by users, using the 'Add Channel' button in the client interface. These temporary channels can only exist if there is at least one user in them. If a temporary channel becomes empty, it is deleted by the server on which it was created and an updated message is sent to all clients and servers. Both kinds of channels are otherwise managed identically by the server.

Whenever a new local client connects to the server, a separate thread is spawned for that connection. This presents a performance advantage, since there is no single thread that has to do everything. As a result the server does not have to wait for every individual client or server connection to finish its I/O before proceeding on to servicing the next client or handling one of its other tasks. The server also maintains current list of channels as well as which clients are on these channels. Whenever a new message comes in from one of the clients, the server forwards this message to every other client that is on the same channel. Other duties performed by the server for its local clients include status updates and filtering. A status update message containing the number of local users, connected servers, and number of available connections is sent to a client when requested . Whenever a user wants to filter out another user, the client notifies the server and the server makes sure that no messages from the unwanted user are sent to that particular client. Management of remote users is very simple. Each server simply maintains a list of all remote users and what channels they are on. This information is provided to server's local users. Qchat server is also responsible for maintaining connections with other servers. Each server can connect to only one other server, but it can accept any number of connections from other servers. On start up, server reads a file containing the name and port number of a server to which it should connect and attempts to establish that connection. When two or more servers are connected to each other, each sends a list of its local users and channels they are on to all other servers. Whenever an event occurs on any of the servers, such as a user sending a message, user changing a channel, new user connection, or any other possible event, notification of that event is forwarded to every other server, which in turn update their local clients appropriately. Qchat servers also maintain a file containing a list of all users and what channels those users are on. This file is then used by CGI programs which convert the list into HTML and display it when requested.