HTW Berlin Medieninformatik

HTW Berlin
Fachbereich 4
Internationaler Bachelor Studiengang
Internationale Medieninformatik (Bachelor)
Info 2: Informatik II
Summer Term 2018


Exercise 1: Chatterbox

Finger Exercises

Please research the following questions before coming to the lab. Write down your answers and bring them with you for pre-lab check-in. There are many sites that will show you the code for this.

  1. How do you set up am Internet connection between two computers in Java?
  2. Write a method to read from a Connection in Java.
  3. Write a method to write to a Connection in Java.

Required exercises:

These are the required exercises for this session. Work in groups of two, chosen by random. Each of you hands in the same report. Remember to put both your names on the report. You can continue to use BlueJ, or move to Eclipse, if you wish.

  1. Start your chatterbox by writing a method that listens on a port. The ports 8000 to 8010 are open for the lab network. This is your chatterbox server.
  2. Now write a client that writes to that port.
  3. Test your methods on your own machine. For now, just echo what you have read to the console to see it working. Now publish your computer name and port number on the board in the lab.
  4. Start chatting with a few of your neighbors! Describe what works and does not work.

For the bored:

  1. Can you get multiple clients to connect? The server will need a method broadcast that sends messages recieved to all other clients. You will need a collection for keeping track of all clients and an iterator for broadcasting.
  2. Let the clients set a name for themselves and prepend this to all that they say.
  3. Make a singing and dancing GUI for the client!
  4. Remember that support desk application we had? Well, can you set it up so that your server listens for someone to type something, feeds it into the support desk, gets the support desk answer back and returns that to the person asking?
  5. Read up on Eliza and see if you can make a chatterbox "shrink" (psychiatrist).

Your report is due by 10.00 pm the night before your next lab! As in Informatics 1, we are more interested in process than in product, although we are now getting more interested in products as well. Your report should include any collaborators, summarize what you learned, and note the time you invested in this exercise. How many lines of code did you write? Record this in your report.


Copyright Prof. Dr. Debora Weber-Wulff
Questions or comments: <weberwu@htw-berlin.de>
Some rights reserved. CC-BY-NC-SA - Copyright and Warranty