CS 450 - MP2

Spring 2005

Video Streaming Using UDP

Due: March 30, 2005 at 11:59 pm

You may work on this program in groups of 1 or 2 students.

For this assignment, you will create a very simple (and crude) streaming video server that uses UDP for the underlying transport protocol. This assignnment will assume the use of Java since the video display will assume the use of the Java Swing JLabel.

This "video" is really an automated film strip. The video stream will actually be individual images that are sent from the server to the client using Java DatagramPackets. Each image will be sent in its own packet. The clients job is to take each packet as it is received and display the contained image.

When the client is started, the machine name for the server will be given as a command line arguement. If no machine name is given, you may assume the server is running on the same machine (and has the name of 127.0.0.1). The port used by the server can be hardcoded into both the client and the server. This port number should not be a "well-known" number. It is suggested that you use add 10,000 to the last 4 digits of your UIN to create a "random" port number.

The server will serve up its video from a certain directory. The location of this directory will be given as a command line argument to the server. This directory could be specified by either a relative or absolute path name. If no directory is specified, the current directory is assumed to hold the videos. The directory specified may contain multiple videos. Each video will be kept in its own sub-directory. The contents of each subdirectory is assumed to by only image files (you may assume jpg images). There is such a directory set up at:

	~i450/WWW/mp2dir
which is duplicated at
        ~i450/mp2dir
This directory has the following sub-directories: In each of these sub-directories are the JPG image files that contain the frames of the video. You are to assume that the frames are named in alphabetic order.

The server accepts two types of requests: a video list request and a play video request.

A possible layout for the client could be as follows. Note that this is created using HTML tables and not Java GUI elements; therefore, exact recreation using Java GUI elements is not required (or even expected).

Available Videos:

The Get Video List button will have the client send a Video List Request to the server. The responses sent back to the client should be used to fill in the list with available video choices.

The Play Video button will have the client send a Play Video Request to the server. The responses sent back to thge client should be used to update the image.

Some Sample Code

The following two examples should help with some of the Java coding details needed for this assignment. Both examples use the Java Swing class JList. The first example also shows how to read an image in as a byte array and how to then display the byte arrayed image as a JLabel. The five images (taken from http://logos.cs.uic.edu/reed/PERSONAL/pics/LoseTheBeard.html) are used by the first program.
  1. ImageTest.java

  2. ListDemo2.java

    This program is made a bit more complicated than we need it with the enabling/disabling of the buttons.

Submission of the program

Your program is to be submitted electronically via the turnin command on the LINUX machines. The project name for this is mp2. All programs are expected to be written in good programming style using the java programming language.

Submit your program electronically using the "turnin" command from your CS account as follows:

turnin -c cs450 -p mp2 [your project directory]
where the [your project directory] is the directory name under which you have all your files related to this programming problem. The turnin command will automatically compress the data under your directory, so there is no need to do the compression by yourself.

Notice you can only invoke turnin command on the Linux machines in the lab or after logging into the server machine oscar.cs.uic.edu.

If you want to verify that your project was turned in, use the verify option -v with the turnin command. For instance for this project, from your CS account you would type:

turnin -c cs450 -p mp2 -v

Note that you can execute turnin as many times as you would like, up until the program deadline when turnin will be disabled for this project. Each time you execute turnin for a project, you overwrite all of what you had turned in previously for that project. Turnin does not allow for incremental submission of your project.