Whiteboard with Java multicast and simplified RTP

Program Documentation

Hong Shi
Center for Telecom Research
Columbia University
New York, NY 10027
hshi@ctr.columbia.edu 

Abstract

In this project I implemented a simplified whiteboard (a chat tool) with Java multicast and Real-Time Transport Protocol (RTP) [1] as the underlying network platform. The project focuses on building the chat tool for collaborative computing, and explores the feasibility and applicability of using RTP in this non-real time application. This report describes the architecture of this application and implementation details, and discusses briefly what improvements I would like to add into the application.

System Requirements

This application is developed in Java. Because of Java's platform independent property, and there is no native code used in this application, it can run on most systems. However, it is developed using JDK 1.1.4, a JDK version of 1.1 or above is necessary to run the whiteboard.
Since this is a network application, a network connection with a TCP/IP stack is necessary. It can be in the form of a LAN connection or a dial up connection. If it is only for test purpose, it can be run on a machine without network connection.
 

Installation

To install, simply download (zip file or tar file) and expand all .class file into the destination directory, and add the directory into your CLASSPATH environment variable (this is not necessary if your only run the whiteboard from that directory). To start the whiteboard, type

java Wb

at your system prompt.

User Manual

When the whiteboard application is started, the following dialog box appears:

The dialog box asks the user to enter his/her name, email address and a multicast address and a port number. The user's name and email address serves as an ID and provides some basic information about the user. The application will use these information in addition to host name to distinguish among users/group members.

At this moment, there is not validity checking on the User Name and Email Address field, the application will take any input from user and store it. On the other hand, it performs checking on the Address and Port Number fields. The address given has to be a mulitcast IP address, and the port number needs to be between 1 and 65535. If an invalid address or port number is given, a stop message will appear, and the user has to correct it before continue.

When this step is finished, the whiteboard main window appears, as following:


 
 The window is composed of three areas: the message area, the participant list area, and the message input area. All messages received, including the user's own, are displayed in the message area. The participant list area maintains a list of current session participants, in the format of user@host. The user enters message in the message input area. Whenever an "Enter" key is pressed, the message is sent. If the user wants to leave a session, he/she can select the "Leave Session" menu selection under the "File" menu. The participant list area would show whoever has left. The application can be terminated be clicking on the "x" at the top right corner of the window, or select "Exit" selection under "File" menu.
 

Java classes documentation

The Java classes created in this application are described in detail in this section.
 
 
Class Names Class Descriptions
Wb This is the main class. It first create the dialog to get necessary session and user information from the user. Then the class creates the main window of the whiteboard. The class also create a separate thread to receive messages sent from other session members. Yet another thread is created to handle RTCP packets. These packets are used to maintain the status of the whiteboard session. Several inner class or local class are created and instantiated in this class. They are used as event listeners as required by the new Java event model.
RTPSender This class implements KeyListener interface. It takes care of sending out any messages the user has typed in. It is registered as the KeyListener of the message input field. Whenever a key is pressed in the field, the keyPressed method in this class is called. If the pressed key is the "Enter" key, the text in the field is retrieved. This text is put inside a RTP packet, and is sent to the multicast address/port. The payload type (PT) is set to 80, this value is an unused PT in the protocol.
RTPReceiver This class is a subclass of Thread class. An instance of this class is instantiated and started as a separate thread by the Wb class. It is responsible for reading in network packets sent to the multicast address/port number. When a packet is received, it strips off any RTP headers, and displays it in the message area.
RTCPHandler This class is a subclass of the Thread class. An instance of this class is instantiated and started as a separate thread by the Wb class. This thread handles activities related to maintaining the states of  the session. It creates another thread to receive RTCP packets, and handles the sending of RTCP packets in the thread itself. It calculates the interval between sendings, and sleep for that interval after sending out each RTCP packet. If the user has sent out any message since last RTCP packet, an SR packet is sent, otherwise an RR packet is sent. If the user decides to leave the session, a BYE packet is sent. Whenever a packet is sent, it clears the senders count to 0 in the SessionInfo class.
RTCPPackets This class is contained in the same file as the RTCPHandler class file, as such, it is only visible to RTCPHandler class. Because I use a simplified RTP/RTCP format, the RTCP packets has the same format for each whiteboard user. This class creates the SR, RR and BYE packets in advance, so the RTCPHandler class can use them whenever on is needed. Each RTCP packet is a compound packet composed of either one of SR or RR packet, an SDES packet, and BYE packet is followed, if any. In the SR and RR packet, the SC and RC are set to 0, and all the timestamps and the sender's packet count, sender's octet count in the SR packet are also set to 0. In the SDES packet, the CNAME, NAME and EMAIL field are present. The CNAME is the in ther format of user@host. The "user" part is from the user input, and the host part is obtained by calls to getLocalHost and getHostName methods of InetAddress class. Both NAME and EMAIL are from user input.
RTCPReceiver This class is a subclass of the Thread class. An instance of this class is instantiated and started as a separate thread by the RTCPHandler class. This thread listens and receives any packets sent to the multicast address and RTCP port number (the port number which the user gives plus 1). These packets are compound RTCP packets created in RTCPPackets. When an SR packet is received, it increment the senders count in the SessionInfo class. Whenever an RR packet is received, it checks to see if the sender is already recorded in the SessionInfo. If not, it adds this sender to the record, increments the members count, and displays the sender's information in the participant list area. When a BYE packet is received, it removes the sender from the record, and decrements the members count.
ParticipantInfo This class contains the information about a paticular participant. The fields in this class are: CNAME, NAME, EMAIL and SSRC.
SessionInfo This class contains the information or state of the whiteboard session. It has two vectors, one vector has intances of ParticipantInfo class as its elements. This vector gives information about all participants. Another vector contains the SSRC of all the participants. This is used as an index into the other vector. Other information contained in this class are: senders and member s count of the session, a flag indicates if we have sent out any message during the last RTCP interval, a method to calculate the interval to send RTCP packets, and methods to add members, remove members, and get and update values of some other fields. The algorithm for calculating RTCP interval is from RFC 1889, appendix 7. The RTCP bandwidth is set to 625 bytes per second, assuming a 100k bps total session bandwidth.
 

Restrictions

Due to time constraints, the RTP/RTCP protocol implemented in this whiteboard is simplified. The major restrictions are the following:

Future Work

There are many components/functionalities that should be added into the whiteboard application, I list them here in the order of importance and relevance:

Acknowledgement

The basis for this implementation is the RFC 1889. All the protocol detail and some algorithms are from there. Cheok and Li's  report provided some initial ideas for the implementation.

Reference

[1] RFC 1889, RTP: A Transport Protocol for Real-Time Applications, February, 1996