HUMBOLDT-UNIVERSITÄT ZU BERLIN
COMPUTER SCIENCE DEPARTMENT
Systems Architecture Group

Head: Prof. Dr. Jens-Peter Redlich
Secretary:  Silvia Schoch
Phone: +49(30)2093-41150

 

     

Assignment 0: Warmup

Credits

Edward W. Felten, http://www.cs.princeton.edu/

Logistics

There is no need to submit a lengthy "solution" to this assignment --- just submit a statement saying that you did the assignment (for example, "I completed assignment 0.").

You must do this assignment yourself, but you may ask other students for hints or advice.

Introduction

Several lab assignments later on will ask you to improve the security of the software for a simple chat service. We will provide you with the chat service's software, and you will improve it. The goal of this "warmup" assignment is to make sure that (a) you can compile and run the chat software, and (b) you understand how to use it.

You can get a zip-file containing the chat software here. The software is written in Java (Version ≥ 1.4).

You can do this assignment (and all other programming assignments) on any machine you like, but your lab solutions must compile and run on a Linux machine (i.e., mitte.informatik.hu-berlin.de). Java code tends to be very portable, so we don't anticipate many portability problems, but it's your responsibility to verify that your code works on the SAR machines.

Compile and Run the Software

Your first task is to get the software to compile and run on your machine. Unzip the software into a fresh directory. If you're lucky, you can just type "make" or "javac *.java" in this directory and everything will compile. If not, you'll have to figure out what's wrong and fix it.

This is a good time to share hints with each other.

Try It Out

Now that the software compiles, you're ready to run it.

The software actually consists of two programs, ChatServer and ChatClient, which share some code. ChatServer listens for connections from ChatClients, and manages a chat room for these ChatClients. You can run as many ChatClients as you want. Each ChatClient represents one user who is joining the chat room.

First, you'll need to edit the "config.txt" file to configure the service so that it doesn't conflict with other students' versions of the service. The issue here is that each student's ChatServer will want to listen on a particular port on the machine; if two ChatServers try to listen on the same port, one of them will be unable to do so. So each student needs to use a unique port number. To do this, edit the config.txt file and follow the directions in that file. When you're done, save the file and exit the editor.

Now you're ready to run the program. Open four shell windows (or command prompt windows on Windows), all located in the directory containing the compiled code. In the first window, type the command "java ChatServer". The ChatServer program will start running, but it won't provide any output yet. It will just sit there, waiting for connections from clients. If you see an error message, something is wrong and you need to figure out what it is. Feel free to ask for help if you have trouble.

Now go to a second window and type "java ChatClient Alice". This will start the chat client, but it won't print anything.

Go to the third and fourth windows and type "java ChatClient Bob" and "java ChatClient Charlie" in each of them. This will start two more chat clients (for a total of three). As of yet, none of the windows will have printed anything. If you see any error messages during these steps, you'll have to figure out what is wrong. Feel free to ask for help if you have trouble.

Now you're ready to chat. Go to one of the ChatClient windows and type a line of text, hitting Return at the end. That line of text should appear in the other two chat windows.

Switch back and forth a few time between the ChatClient windows, typing lines of text to simulate a chat session between three people. Whenever you hit Return in a window, the line of text you just typed should be echoed into the other windows.

That's all. In the next assignment we'll start improving the chat service's security. You might want to start reading the chat service's code to figure out how it works.

 


Legal disclaimer. .  © 2024 Humboldt-Universität zu Berlin, Computer Science Department, Systems Architecture Group. Contact: sar@informatik.hu-berlin.de .