CS 145A Lab 3 (due: Nov 21st 23:59:59)
Reliable Communication
Tasks for Lab 3: Implement a reliable communication protocol over UDP:
- Revise your packet format
- Implement packet retransmission
- Improve efficiency (Optional. But it is the requirement of Lab4. If you want to reuse your code in Lab4, please design the program to be extensible for rate control)
Requirements:
- Write two programs: "Sender" and "Receiver"
- The sender is able to send a file to the receiver. The receiver is able
to receive the file.
- The implementation is based on UDP.
- The network in the middle is not reliable: The network may drop or duplicate or reorder
some packets in the middle.
- The size of each packet (including header) should be smaller or equal to 512 Bytes.
- Assumption: A single packet will not be contaminated. (Don't worry about
the error inside one packet. You don't need to implement checksum.)
- Assumption: There is only one sender and one receiver.
Sender:
Command Format: "sender <port1> <IP> <port2> <Filename>"
- Port1: the port you are listening to the receiver's feedback
- IP: the receiver's IP
- Port2: the receiver's port
- Filename: The file to be sent
Sender should be able to read the file (specified by <Filename>) from
local disk, cut it into packets, and send it to the receiver (specified by <IP>
<port2>).
Sender can use <port1> to listen to the feedback from the receiver. Also,
the sender should be able to retransmit the loss packet if necessary.
Receiver:
Command Format: "receiver <port1> <IP> <port2> <Filename>"
- Port1: the port you are listening to the sender's data
- IP: the sender's IP
- Port2: the sender's listening port
- Filename: The file to be saved
The receiver should listen to <port1> for data, write the data to <Filename>
and send feedback to <IP> <port2> (sender) if necessary.
Possible Problems:
- How to design the packet format?
- What kind of feedback? (ACK/NACK?)
- How to detect loss? (Timeout? Duplicate ACKˇ)
- How to maintain the window (If you use window scheme)?
Submission:
Please submit your code and your documentation (sender.txt and receiver.txt).
In the documentation, please write down your design of the program, describe
your test suits briefly. Also, please write comments in your codes to help
TA to understand your code.
Grading:
The TA will have two relayers which may drop packets in the middle.
The "sender" under test will send data to the relayer and the relayer
relays the packets to the "receiver" under test. The same happens
in the feedback channel. So, the data packet or feedback packet may dropped
in the middle.
TIPS
- Re-Use the UDP codes in Lab 1 and the codes in Lab2 (You can use either the reference code or
your own code. )
- Packet format: Possibly, you may want to include some of the following options in your packet header:
Packet type (initial packet, ack packet, terminating packetˇ), Packet length,
Packet sequence number, Data areaˇ You may refer to the TCP packet format
(in RFC 793) to get more ideas.
- How to implement the retransmission: Possibly you may want to maintain a
"window", or other similar mechanisms.
- How to Test: You can intentionally drop packet in the receiver side or
the sender side (by slightly changing your codes), to see if your implementation works well. You can also use TA's relayer to test your code.
TA Hours:
Tue / Thu (20:00~22:00) JRG 170