Solution to 2nd assignment

Time is out. Here you have one solution to the second assignment. Whether you failed it or you are interested on learning how to do it, you can used this code as a reference implementation.

All submissions have been marked. You can see your mark on the attendance page, assignments tab. If you submit your assignment and the mark is missing, please send me an email.

Solution to 1st assignment

A sample solution.

Important reminder

Next Thursday, December 9th, there is a change in the regular class schedule and classes will proceed as if it were a Monday at ETSINF (please note this does not apply to other schools or studies).

We do not have lectures on Mondays but we do have lab sessions. Remember this not to miss anything.

Attendance rate is declining fast

If you look at the attendance record you'll see that I've added two rows in the bottom showing the total number of attendees on each session and a moving average too.

I can see there is a steep decline in the attendance to the class. Whether this is due to a problem that can be fixed or not I do not know. I just hope you're not given up the subject as still there is one month left. If there is something that needs to be changed in the classroom just talk to me.

Attendance to my office hours is very low too. I just want to remind you that I am here to help and that office hours are part of the instruction.


Sample micro web server

The sample code shows a very basic web server that handles requests one at a time. A text line is printed showing the file requests. Please note the contents to be served has to be in the same folder of the server binary.

BTW, web server listens on port 7777, but you may change that if you wish.

Click on this entry's title to see the code on pastie's page. Please note there is a download link on the upper right corner there.

Second assignment


Though you still have two weeks to turn in your first assignment, the second one is published too.
Do not worry because you have till December 20th, 2010.

This time it is a server what you have to do (a multi-threaded server). The good news is that the application protocol is very simple. After connecting to the server, the client may send one line of text containing an arithmetic expression (i.e. 1+2*3/4) and the server will respond with another text line containing the result of evaluating this expression (i.e. 2.5) or an error message if there is something wrong with the client expression.

Client will signal the server its willingness to quit by sending an empty line. Server will provide no other answer to the empty line but closing the connection.

Several clients can be using the server at the same time and all of them need to be served right away.

You can find here the Eval.java mentioned on the assignment text.

Another useful tool


Though we have mentioned traceroute command in the class. I want to bring your attention to a better alternative: mtr program and its windows version WinMTR.

What it does is a more in depth statistical analysis of the path from your computer to a certain destination. Contrary to traceroute, mtr command is kept running till you press "q" or Ctrl+C as it is constantly updating its measurements.

HTTP and your bike


While you may think HTTP is just a protocol for downloading HTML files, this idea is wrong. HTTP is used daily for transferring many different types of files, from HTML to several graphic formats (JPEG, PNG, GIF, etc) to Cascade Style Sheets (CSS) to JavaScript files and many others.

In this post you can study the way the city bicycle service (Valenbisi) works in order to provide an application the location of the different bike stations and the current state of each one. Here the body of each HTTP response is an XML file.

Armed with this knowledge, this site was created and, believe it or not, it turns out to be much more useful than the "official" one.


The software you don't want your friends to have

Not sure how long this trick will work, but it is a wake up call about Facebook security when it comes to users accessing over wifi networks. We'll be explaining HTTP protocol soon in the classroom, but for Wifi technology you'll have to wait till next term.

I reckon this tool will only work on WEP-protected wifi networks, but I'll be interested on your feedback if you get it working.

Now that "The social network" is on theaters it seems a good moment for this type of information :-)

Short Tutorial on Java Network Programming

I'll be using this material in the classroom to present the basics about Java Network Programming. You can download the PDF file by clicking on this entry title too.
Java Network Programming

It seems the guys at Scribd have some trouble with this document. If you see empty yellow boxes, please download PDF or watch the file on Scribd site (by clicking on Scribd logo) to be able to see the missing code.

Source code is available too.

First assignment is out


This is our first assignment. It is about writing as small web server in Java language. Those of you not familiar with Java might use a different language upon request.

We will present the basic ideas of how to create networking programs in Java in a few days. Please note a sample server is also provided so you can now see exactly what is required.

For running the sample code you need to have a Java Virtual Machine installed on your system. Then at a terminal type: java EchoWebServer
And next type in your browser address bar: http://localhost:8080/anything

Every now and then ...


... we are told the transition to the new version of IP protocol is about to happen. This article says, once more, that old motto (it's been a decade of listening to the same message in slightly different ways).

We will be covering Internet Protocol in Chapter 3. But unless something earthbreaking happens next month, we will still be covering IP version 4 instead of the new version 6 (which is now twelve years old). Whatever it happens, please remember your computer (no matter what OS you use as far as it is recent) already supports both versions.

Labs schedule

You can get a copy of the laboratory sessions' schedule by clicking on this entry tittle.

Course presentation, 2010-2011


Click on this entry title to get the PDF file of subject's presentation slides.

September 2010 marks

Click on the title to go the mark's sheet.

Congratulations to Fernando and Isma that passed the subject.

Your exam is available for you to check it out.

September 2010 exam

A few details about the September 13th, 2010 exam:

  1. At 15:30 the 2nd term exam will be held.
  2. At 18:00 the 1st term exam will be held.
  3. Each part will last two hours.

June 2010 Final Marks

While still you can review your exam and ask for any correction that might be needed, current final marks have been published. Hopefully this will remove the anxiety of some of you about the final marks.

Please note that those with incomplete assessment (i.e. one term exam missing) will get no number in their mark. Instead it will be stated that not enough information is available so as to give any grade.

Those of you that have failed the subject, please remember there will be a new opportunity on September for both, first and second term exams. Also remember the only requirement is that the average mark of both terms has to be equal or greater than 50% to pass the subject. Whether you want to take one or two exams in September is your choice.

Marks are available

Both 1st and 2nd term exams have been marked. For many of you there is a small difference between your assessment and mine. There are a couple of cases where difference has been significant.

2nd Term June2010

I've made every effort to provide an accurate and correct marking, but errors may happen. Should you have any concern about your mark, please let me know.

Please note that the view of marked exams is available only for a limited time and that document download is disabled.

Solved 2nd term June 2010 exam

You can download the solved exam and mark yourself. Please email me your mark. Click this entry title to get the file.

First term exam has already been marked. Results are in the usual place.

Interesting IT security event in Valencia

Asegúr@IT 8 is a one-morning event to be held in Valencia. Speakers are knowledgeable people on the security field. Attendance to the event is free but the seats are limited.

BTW, this event is sponsored by Microsoft and a Passport/LiveID account is needed to register.

CodeJam2010

Maybe timing is not right, but if you want to test your programming skills against other talented people you may want to register for Google's programming contest CodeJam 2010. It's fun (if you like programming challenges) and you'll realize how much you need to learn.

I usually join the contest and I am kick out very soon. Java is among the programming languages accepted. There are many sample problems you can attempt to test your skills before the contest begins. Those of you making it to Round 2 can claim an extra 10% mark.

4th and last assignment is out

This time you have to write a simple "wrapper" code to allow the use of an interactive command-line program through a socket connection. While this can be achieved by piping your command to nc or sock commands, you are required to do this by yourself in Java language.

A brief explanation on how you can launch an external program and access its input and output is provided. You have till May 26th, 2010.

A sample implementation is provided too, but please note it won't work in a Windows computer (unless /usr/bin/bc command is found on your system).

New assignment is out


One of the problems we face when our computer is behind a NAT (or a firewall) is that incoming connections cannot reach our computer. While it is possible to fix this with some additional configuration, this assignment is about creating a piece of software that will help two users to be connected even when they are behind a NAT.

For testing purposes let's assume both users will use telnet application to have an interactive chat session (only two users per chat). Your meeting server will enable conversations between pairs of clients, but at any given moment several independent chat sessions may take place.

You can click on the title to get a copy of the assignment document.

Update: Please feel free to ask any question you might have about the assignment as a comment to this entry. This way other students may benefit from it being answered here to.

Update2: As with other assignments, I'm providing you a sample binary for MServer for you to test.

1st term marks


Exams have been marked. Most of you will find your estimate was pretty accurate, but a few cases differ more than 10%, some underestimated and others overestimated their mark. It is ok. Those having no mark is because they did not show up for the exam.

We've won three new students that just showed up for the exam (so they have 0% attendance), for these people, welcome to the class, I hope to see you more often. It is likely some new Erasmus students will join us for the 2nd term too.

Exam average mark is 45% and term average mask is 50%. Both Juan and Anush are our top scorers this term, congratulations!

However, our top scorer in the exam was not any of them but Michał, who scored 80%, congratulations too!

The most difficult question seemed to be (17) how to print the IP address of a received datagram packet. Nobody realized getAddress method returns a InetAddress object and not an IP address dotted decimal string. For that, getHostAddress method was needed.

Those of you below of 40% this term really need to get up to speed to pass this subject. Whether you plan on just focus on the second term or repeat the first term exam too is up to you. But I strongly recommend you to work quite a bit harder not to fail the subject.

To see the list you can click this entry title or just go to the attendance record link where all the details are found.

Update: You can now check marked exams. Please email me if you find any marking error you want me to have a look at.

Solved exam

Click on the title to have access to the solved exam.

I sent it to all of you by email too.

Please have a look at it and mark your own answers (I guess you remember what you answered this morning) using a digital logic: answers are either right or wrong.

Please note each right answer scores 2%.

Once you have marked your exam I want you to send me an email with your name and mark.

Please do so as fast as possible (as your memory about what you answered today will fade away).

Exam Remainder

Please remember REDES' exam will be held in building 1G next Monday, January 25th, at 9:00. Max exam duration is two hours.

X-ray your network communication

While we've presented netstat as a tool to help you watch your connections, if you're running Windows you may want to hear about TCPview. From their website:

TCPView is a Windows program that will show you detailed listings of all TCP and UDP endpoints on your system, including the local and remote addresses and state of TCP connections. On Windows Server 2008, Vista, and XP, TCPView also reports the name of the process that owns the endpoint. TCPView provides a more informative and conveniently presented subset of the Netstat program that ships with Windows. The TCPView download includes Tcpvcon, a command-line version with the same functionality.

Please note that the tool can also be useful to track down suspicious communications happening on your computer. You can easily know where your computer is connecting to and which process is doing it.