Archive for category assignment
Assignment 3: Solution
Posted by Ooi Wei Tsang in assignment on April 23, 2013
Assignment 3: Marks
Posted by Ooi Wei Tsang in assignment on April 22, 2013
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!
Assignment 2: Marks and Comments
Posted by Ooi Wei Tsang in assignment on April 21, 2013
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.
Assignment 3
Posted by Ooi Wei Tsang in assignment on April 2, 2013
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:
- Start early.
- Do not copy from each other.
Assignment 2: Common Misconceptions and Questions
Posted by Ooi Wei Tsang in assignment on March 27, 2013
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.
Assignment 2: Tricky Synchronization Bug Warning and Fix
Posted by Ooi Wei Tsang in announcement, assignment on March 22, 2013
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 »
CS2105 A1 Q&A Schedule (Second Batch)
Posted by Ooi Wei Tsang in announcement, assignment on March 17, 2013
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
Assignment 1 Q&A Session (Second Batch)
Posted by Ooi Wei Tsang in announcement, assignment on March 17, 2013
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.
Assignment 1 Q&A Schedule (Updated)
Posted by Ooi Wei Tsang in announcement, assignment on March 13, 2013
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.
Assignment 2
Posted by Ooi Wei Tsang in assignment on March 13, 2013
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.
Assignment 1 Q&A
Posted by Ooi Wei Tsang in announcement, assignment on March 6, 2013
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:
- Each team will indicate the one-hour slots where both team members are available, from which we will allocate 5 minutes for each team.
- We will need to stick to the clock exactly, so you must come on time and end on time.
- 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.
- If you missed your slot or is late, there will be no rescheduling and no extra time.
- Both team members must show up on the same time slot.
- At the doodle site, in the column that says “Your Name”, please enter the matriculation numbers of both team members.
Assignment 1: Teams
Posted by Ooi Wei Tsang in assignment on February 13, 2013
Here are the registered (and randomly assigned) teams for Assignment 1 (one line per team).
Assignment 1
Posted by Ooi Wei Tsang in assignment on February 13, 2013
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:
- Start early. Plan your time properly.
- Write your own code. Do not copy from your class mates.
- 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.
- Read the instructions carefully and follow them exactly.
- Ask for help from teaching staff if you have questions.
Getting Ready for Assignment 1
Posted by Ooi Wei Tsang in assignment on January 15, 2013
(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:

Recent Comments