java Wb
at your system prompt.
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.
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. |