Monthly Archives: October 2009

Class code

Thrusday’s class source code below:

How to write to a text file in Java?

I would suggest you to use PrintWriter class to write to a text file the same way you’ll print to a socket. In the below example object out is created so later on out.println(“whatever”) can be invoked.

PrintWriter out = new PrintWriter(new FileOutputStream("received.txt"));

Friday’s code

You can click on the title to get the code I typed in the class today.

Office hours change

I’ve changed office hours due to agenda conflicts. You can see below the new office hours.


This week lab#2 starts. You can get the lab text from this page file repository (or by clicking on this message’s title). On the other hand, it has been a subtle change about lab’s local storage: Now your home directory is set to your own private network storage. So, contrary to what the lab instructs you to do, you can keep the lab folder if you want.

This lab is about using sockets from the command line interface (CLI). FTP protocol is also presented here.


Java Network Programming

There are many good sources to learn from. But I think the best advice I can give you is that network programming is like riding a bike: you learn by doing it.

While on the campus network you can access a huge collection of Safari Books Online. A relevant one is this one.

But among many online resources, the Java Tutorial is worth trying. They even have a Sockets section you may enjoy reading.

Please remember that Java is free and open. You can easily download JDK to your system, so you can both compile and run any examples. I encourage to do so.

First assignment

I’ve published the first assignment on our file repository. If lazy, just click on this entry title.

You have till Nov 20th, 2009 to turn it in. Remember that while optional, assignments will count to your final mark.

Those from foreign universities can use a programming language different than Java.

I’m providing you a sample server binary that, hopefully, will work. You can run it by typing

java SmtpServer

There is been already one submission.

Lab Blues

I failed to mention that there is a self-assessment test at the end of each lab session. Unfortunately these exams are only available in Spanish. The good news is that you can safely skip them. It is ok if you do them too. It is ok if you provide random answers too.

The real assessment for the lab exercises will happen in the written exams, where 30% of the mark will come from questions about the labs. Please note other students (not the English one) have a different policy regarding the lab tests (these being mandatory). Please note the teacher in the lab may not know you’re from the English group.

I am sorry I did not mention that before but please remember last week we did not have lectures of RED.

Fiber optics Nobel prize

It is said that success has many fathers.

Charles Kao, one of the fathers of fiber optic technology has been awarded this year’s Nobel prize in Physics. The prize is shared with two other notable physicists.

This gives you an idea of how important fiber optic technology is.

Odd week

As you know next Friday is a national holiday. Next Thursday, however, it is not a holiday. But, in order to balance the number of weekdays next Thursday will be like a Monday regarding to lectures’ schedule.

So to make a long story short: This week we won’t have RED lectures.