CS 145A Lab 4 (due: Dec 6th 23:59:59)
Reliable Communication
Tasks for Lab 4: Implement a reliable communication protocol over UDP:
- Define your packet format
- Implement packet retransmission
- Improve efficiency (Option)
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 duplicated
some packet in the middle
- Assumption: A single packet will not be contaminated. (DonĄ¯t worry about
the error inside one packet)
- 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 write two "relayer"s 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. The implementations that can successfully transmit a >10KB
file will get full score. The fastest implementations may get bonus.
TIPS
- Re-Use the UDP codes in Lab 1 (You can use either the reference code or
your own code. )
- Packet format: Possibly, you may want to include some of the following options:
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, to see if your implementation works well.
TA Hours:
Tue / Thu (20:00 ¨C 22:00) JRG 170
Except: Nov.19 / Nov.21