Here is the solution for the final exam. My comments on common mistakes are embedded inside.

And now, a personal message: I would like to thank all of you for being patient with me throughout the semester. This semester’s CS2105 has been the most difficult semester for me to teach: (i) the class size increases to a record high of 191, (ii) the number of TAs reduces to 1, and (iii) I just become a father to a pair of twins in Dec 2013 and am in the constant state of sleep deprivation for the whole semester. I have been late in posting class materials, returning assignments, and returning emails (or not returning emails). I have made mistakes in some of the lectures and spoken incoherently occasionally, and yet you all have been the nicest bunch of students and have tolerated these. Some of you even have kind words for me despite all of these, and that kept me going. So, thank you.

I hope you have enjoyed CS2105 and have learnt something useful. Have a good break!


Assignment 3: Returned

I have emailed your Assignment 3 scripts back to you to your NUS email account.

Due to a bug in the process, however, a small number of scripts are scanned twice, and so some of you received two emails. Sorry about this.

More seriously, a small number of you did not have your scripts scanned initially. I have tried to check through everyone and rescan/email back those that I missed the first round.

If by now you still have not received your Assignment 3 by email, please let me know.

Past Year Exam Papers

Here are two past year CS2105 exam paper set by me:


Oh, here are some MCQs that have been rejected as exam questions this year.

1. Which of the following is a VALID networking protocol?

2. Which of the following is NOT a table used in networking protocols?
A. Switching Table
B. NAT Table
C. Forwarding Table
D. Routing Table
E. Premier League Table


Assignment 3 Submission Log

Some of you are anxious if we have received your Assignment 3 submission or not, especially those who slipped the answer sheet under my door.

This is good, because this means you understand well how reliable protocol works, and you are waiting for an ACK from the receiver! You are also worried that Trudy might have intercepted your submission.

Instead of sending back an ACK to individual students, I will broadcast the ACK periodically. So here is the Google Doc that lists the hardcopy answer sheets to Assignment 3 that we have received. The list will be updated a few more times until the deadline.

List of Assigment 3 Received (Hardcopy Submission Only)

Assignment 3: Update on Submission Instructions

Since the deadline falls on a public holiday, we have decided to allow softcopy submission in addition to hardcopy.

If you decide to submit a hardcopy, you can still pass them to either Wei Tsang or Saeid as per instructions.

If you wish to submit a softcopy, please read and following the instructions below carefully.

  1. A PDF answer form has been made available.
  2. Use any decent PDF viewer/editor to fill up the form with your answers. Remember to save the form after you fill it up with your answers.
  3. Rename the form a3-A1234567X.pdf, replacing A1234567X with your matriculation number.
  4. Submit the form into IVLE workbin here, before the deadline.


  1. Please do not submit any other forms of softcopy (e.g., something scanned from a scanner, an image of the answer sheet taken with your phone, a text file edited with vim, etc.) Only the filled up version of the PDF form above is acceptable.
  2. Please do not email us the softcopy. Do not submit a floppy disk containing the softcopy either!
  3. Please name the PDF file according to the convention a3-<matric number>.pdf. Do NOT name it as a3-<nusnet ID>.pdf. (Your matriculation number ends with an alphabet).

There is a 1-point penalty for each violation of instruction above.

Assignment 2 Solution

I have finished grading Assignment 2.

There are couple of common mistakes that worth highlighting here:

  1. If you receive a corrupted packet, you should not look at the content of the packet, since you cannot tell which bit is corrupted! Many of you still assume that p.seq is valid even when p.isCorrupted is true. For this, I takes off two points.
  2. Another common bug is that you did not make sure that all timers are cancelled when the connection is closed. As a result, the sender goes into infinite loop sending forever (and encountering exceptions forever).
  3. The last packet should be treated as any other packet. This means the sender should still ensure that it is received correctly, by repeated retransmitting until it does. Some of you forgot about this and only ensures that the packets are sent correctly, except the last one!

Lecture 12: Putting Things Together

14 April, 2014.

Today, we are going to see how the five layers work together through the examples. We will end the lecture by distilling some of the most important tricks that engineers have used to build computer networks, and higlight how it is used in different parts of CS2105.

Reading: 5.7 A Day in the Life of a Web Page Request

Slides: PDF

CS2105 In the News: on the Heartbleed bug of OpenSSL


Anyway, the heartbleed bug pretty much allows an attacker to probe a server that will end up revealing the private key. Once an attacker knows the private key, they can decrypt session keys that have been sent to the server, and thus decrypt all of the encrypted traffic that goes back and forth between the browser and the server.
Another bit of magic with public key encryption is the notion of “digital signature.” Your browser can create a mathematical challenge using the public key that only someone with knowledge of the private key can solve. This is part of how a website proves to a browser that it is what it says it is. If an attacker learns the private key of some website, then it can masquerade as that site.
All in all, the capture of a server’s private key is a bad thing, and that is what this bug enables.

CS2105 in the News: Global Internet security “keys” generated for the first time at NUS


This project is part of a global effort to make the whole DNS secure and the Internet safer. The DNS is the directory that links web addresses to numerical IP addresses. Without the DNS, people would have to type difficult-to-remember numbers instead of a memorable name to get to a website or send an email.

Using a master key, the keyholders generate cryptographic keys that are used to sign domains, verifying that each entry on the DNS directory is authentic. This prevents a proliferation of fake web addresses which could lead people to malicious sites, which can be used to hack computers or steal credit card details.