Archive for category assignment

Assignment 3: Solution

Here is the solution.
Note that there is much confusion regarding Question 1 Part (l) (are they in the same LAN?).  Since this question involves concepts that contradicts what you learnt in CS2105, I have decided to give 2 marks for this question regardless of what your answer is.
You will see an update to your A3 score in IVLE later. (update: 11am 24/4, IVLE updated)

2 Comments

Assignment 2: Solution

3 Comments

Assignment 3: Marks

The marks for Assignment 3 has been loaded into your IVLE gradebook. The solution and explanation will be posted.

If you spot any surprises in your marks. Please don’t panic; send us an email!

2 Comments

Assignment 2: Marks and Comments

I have finished grading Assignment 2. There are several common mistakes that I would like to highlight below:

  • If a packet is corrupted, you should not make use of the content of the packet! Many of you still uses p.seq even when p.isCorrupted is true.
  • Sending and receiving the last packet (with a size of zero) should be handled reliably as well. Not handling this may cause the sender or receiver to wait forever.
  • Some of you send every packet twice. The second parameter of the schedule(task, delay, period) method tells the timer when to first execute the task. If you use a delay of 0, the task (which runs udt.send(p)) is executed immediately. Thus, if you call udt.send(p) in the send() method of RSTSender already, you effectively are sending every packet twice.
  • To exit gracefully, the sender needs to ensure that any outstanding timer has been cancelled. Many of you did not cancel the timer either in the finally clause or in the catch( ) clause, possibly causing the sender to hang (and continue retransmitting).

The marks for Assignment 2 has been loaded to IVLE. Annotated version of your code has been deposited into your cs2105-z home directory. As usual, if you see any surprises or spot any bug in grading, please email me ASAP.

No Comments

Assignment 3

Here is your third and final assignment. You may download the PDF version of Assignment 3 here and the packet dump here. You have two weeks to complete this assignment individually. The assignment is due on 15 April, 2013, 6pm. You may hand in a hardcopy to me before the deadline. Some words of advice:

  1. Start early.
  2. Do not copy from each other.

2 Comments

Assignment 2: Common Misconceptions and Questions

We received many questions about the following points:

  • Should I call send( ) of RDTSender or UDTSender when I retransmit?

    Note that when you retransmit, you are not sure if retransmission will be received or not — in other words, retransmission is done UNreliably.   If you call send( ) of RDTSender to retransmit, this could work as well, but since this leads to recursion, it is less straightforward and bug prone.  Unless you really know what you are doing, I would recommend the most straight forward method.

  • What should I return if RDT’s recv( ) / send( ) did not receive the expected DataPacket or AckPacket?

    This is an invalid question.  RDTSender’s send( ) should send the given data reliably.  It should not return until it ensures that the given data is received by the receiver.  Similarly, RDTReceiver’s recv( ) should return the next chunk of data.  It should not return until it can deliver the next chunk of data.

  • Why did I get XYZ Exception and how should I handle it?

    If you get an exception related to object streams, this is very likely caused by having multiple timers active at the same time or multiple send( ) at the same time. Check that you have only one timer at a time, and there is no possibility that two send( ) is called at the same time.

    If you get an exception at the sender due to receiver closing of connection after the receiver receives the final packet, this is excepted. You should just catch the exception, clean-up the sender, and return.

    If you get a null pointer exception, figure out which pointer is null. Then check that the variable is initialized properly and the variable is accessible within the correct scope. We can’t help much with this one since, unlike the above, this exception is a general programming bug rather than protocol bug.

No Comments

Assignment 2: Tricky Synchronization Bug Warning and Fix

There is a tricky thread synchronization bug, discovered by Junliang, that could manifest if you create your timer first before sending your DataPacket. The bug causes an IllegalClassException when the receiver reads the DataPacket.

To prevent this bug from biting, you need to either (i) send the DataPacket before setting the timer, and ensure that only one timer is active at a time, or (ii) add the keyword “synchronized” in the send() method of UDTSender as follows:

    /**
     * Given a data packet from RDTSender, this method sends
     * the packet to the receiver by writing it into the
     * object output stream.
     */
    synchronized void send(DataPacket p) throws IOException
    {   
        System.out.println("S: send " + p.seq);
        oos.writeObject(p);
        oos.flush();
    } 

You can add this keyword yourself, or copy a new version of UDTSender:

   cp ~sadm/a2/UDTSender.java ~/a2

(after making sure that your local copy of UDTSender.java is writable)

If you are familiar with thread synchronization issues, and would like to know more, read on.
Read the rest of this entry »

No Comments

CS2105 A1 Q&A Schedule (Second Batch)

This page will be continuously updated according to recent sign ups. If you have signed up and your team is not yet listed, please check back periodically for updates.

WHO                  WHEN                          WHERE
A0084383Y            18 March, Monday   4:00pm    AS6 #05-14
A0106572J U096070W   18 March, Monday   4:05pm    AS6 #05-14
A0067407A            18 March, Monday   4:10pm    AS6 #05-14
A0091726B A0091747W  18 March, Monday   4:15pm    AS6 #05-14
A0088776E A0085686L  18 March, Monday   4:20pm    AS6 #05-14

A0069945L A0067387N  18 March, Monday   5:15pm    AS6 #05-14
A0081146L A0085736U  18 March, Monday   5:20pm    AS6 #05-14
A0083648U U0909018U  18 March, Monday   5:25pm    AS6 #05-14	

A0091621M A0091834B  19 March, Tuesday  3:00pm    AS6 #05-14
A0088828J A0084644Y  19 March, Tuesday  3:05pm    AS6 #05-14	
A0106855B ...	     19 March, Tuesday  3:10pm    AS6 #05-14

No Comments

Assignment 1 Q&A Session (Second Batch)

For those who did not sign up, did not show up, or were away last week and missed the Q&A session, please sign up for your Q&A session at http://doodle.com/kmuez67yr2cnawv6

Note that the week of  18 March is the last week where Q&A session is organized.  We will finalize the marks for Assignment 1 after this and any no-show will receive 0 for Q&A. 

No Comments

Assignment 1 Q&A Schedule (Updated)

Update: 14 March 4:40PM. The venue for Friday’s session (after 11am) has been changed from DR5 to DR9 (COM2 04-06). The venue for Friday 10am – 11am session remains the same.

Please see below for the Q&A schedule. Please be punctual. We will do our best to keep to the schedule. Please excuse us for not having time for pleasantries and small talks during the Q&A session :)

Please report any bug in the schedule.

Read the rest of this entry »

8 Comments

Assignment 2

Here is your Assignment 2 on simulating alternating-bit protocol.

This is a simple assignment (the solution is only ~40 lines of code) to be completed and submitted INDIVIDUALLY before 31 March, 2013, 11:59PM.

Please start early.

102 Comments

Assignment 1 Q&A

Please book your slots for Q&A here before the end of Tuesday (11:59pm, 12 March 2013).

http://doodle.com/ci5spkm2b9h5aq6f

Here are the rules:

  1. Each team will indicate the one-hour slots where both team members are available, from which we will allocate 5 minutes for each team.
  2. We will need to stick to the clock exactly, so you must come on time and end on time.
  3. We will randomly ask each student to explain a random part of the code.  Your answer will constitute 2 marks of your individual Assignment 1′s grade.
  4. If you missed your slot or is late, there will be no rescheduling and no extra time.
  5. Both team members must show up on the same time slot.
  6. At the doodle site, in the column that says “Your Name”, please enter the matriculation numbers of both team members.

No Comments

Assignment 1: Teams

Here are the registered (and randomly assigned) teams for Assignment 1 (one line per team).

Read the rest of this entry »

No Comments

Assignment 1

Here is your first assignment. You may download the PDF version of Assignment 1 here. You have two and a half week to complete this assignment (excluding recess week) in a team of two. The assignment is due on 10 March 2013. Some word of advice:

  1. Start early. Plan your time properly.
  2. Write your own code. Do not copy from your class mates.
  3. Read the description carefully. It is long, but is full of useful information. The assignment is rather straight forward once you understand what to do.
  4. Read the instructions carefully and follow them exactly.
  5. Ask for help from teaching staff if you have questions.

153 Comments

Getting Ready for Assignment 1

(updated with link to register your assignment teams)

Assignment 1 will not be released in three weeks time, but it is not too early to get ready!

Things to do:

  1. Do you have an SoC UNIX account?  If not, apply one here.
  2. Need to brush up on Java?  Now is the time.
  3. Need to find a partner?  Comment on this post to find each other.
  4. Have a partner?  Register your team here.

22 Comments