The many uses this blog


I was reviewing last year's posts and I realized that many of the posts are applicable now as we are going through the same chapters at the same time. So instead of reposting the same entries I invite you to check last year's entries along the whole course and there you'll find useful information, interesting links and related material.

Please note that assignments are different.

Class attendance record

These are the attendance numbers so far (out of 13 classes).





















Ayoub10

Aitor13

Martin9

Luis Manuel8

Edgar10

Carlos8

Erol1

Ramazan12

Jakub1

Roberto2

Ana6

Manuel6

Javier11

Taha9

Carlos S1


Please note that some of you are joining the class quite late. I understand that you may have other subjects too, but please note you'll need some effort to catch up with the class.

Sample IM server application

I've created a server application like the one you have to write for assignment #1.

You'll find it running on port 7777 on the IP address 158.42.53.17. If for some reason it is not accepting your connections, please let me now, as a power outage might have happened on my side and manual restart would be needed.

Please note that the messages about a new client entering the server or a client leaving the server are not required on your code. I've just added them to give users a bit more of information.

News and reminders

Since Nov 16th we will be back to the "Seminari Nord" room. I've just posted the text of the first assignment, and I want to remind you that --although it is optional work-- doing it right will be worth 5 out of 100 points.

You do the four scheduled assignments right and you already have 20% of the subject.

You come to all the classes and you have 10% more.

Still not enough to pass the subject (you need 50%) but closer ...

Just a word of warning: Assignments are personal work, not team work. Your code will be checked against all the other submitters. If a copy is found all the involved parties will score 0% no questions asked. It is in your best interest to keep your work for yourself.

As with any other doubts you may have about the subject, I'm available during office hours for helping you solving them.

Programming Assignment #1

Instant Messaging Server

Your job is to write a Java application that will act as a the server for an Instant Messaging application. Clients will connect to the server [using a TCP connection] to talk to each other. Clients will type messages that are composed of one or more lines of text. Each time a user types a new line of text at the keyboard, that line will be transmitted to the server.

Each time the server receives a new line from any client, it will send a copy to all the clients but the one who sent it (i.e. to prevent a confusing double echo on the sending-client side).

Any client that wants to abandon the service MUST type a line with the text QUIT. Whenever the server receives such a line of text it will interpret its meaning, closing the socket this client was using. From them on, no attempt to send any more data to that client will happen (note: trying to send data to an already closed socket would trigger an exception).

Still, a client could leave the service by just closing the connection without the mandatory QUIT command. You do not need to manage that case though.

Your Code

Your code has to conduct the following tasks:

  1. Accept any number of simultaneous clients, but it is safe to assume no more than one hundred simultaneous clients.

  2. Retransmit any text line, including empty lines, to any active client but the one typing that text line.

  3. Not to retransmit those lines which only contents is the QUIT command. Any combination of upper and lower case characters should be accepted and recognized (i.e: both QuiT and quit should work too).

  4. The server program prints “NEW CLIENT” whenever a new client connects to the server and it prints “CLIENT GONE” when any client quits the system.

Some tips

  • Server listens on port 7777

  • You may use several telnet windows as clients of your server (for testing purposes) by just typing;

telnet localhost 7777

Due date

Your Java source code has to be submitted by email (address available on the front page) by Nov 30th.

If you have any doubt about the assignment I strongly suggest you to stop by my office during office hours (posted on the web).