Presentation is loading. Please wait.

Presentation is loading. Please wait.

C OMPUTER NETWORKING HOMEWORK 2. UDP VS. TCP UDP Unreliable Unordered delivery No congestion control, flow control, connection setup TCP Reliable In-order.

Similar presentations


Presentation on theme: "C OMPUTER NETWORKING HOMEWORK 2. UDP VS. TCP UDP Unreliable Unordered delivery No congestion control, flow control, connection setup TCP Reliable In-order."— Presentation transcript:

1 C OMPUTER NETWORKING HOMEWORK 2

2 UDP VS. TCP UDP Unreliable Unordered delivery No congestion control, flow control, connection setup TCP Reliable In-order delivery Congestion control Flow control Connection setup

3 T ARGET Implement TCP by UDP Socket programming

4 A RCHITECTURE (1/2) Implement programs File transmitter 1 program for both sender and receiver or 1 program for sender and 1 program for receiver are all permitted Agent File transmitter Reliable transmission on UDP Congestion control Agent Control loss rate

5 A RCHITECTURE (2/2) Sender A Receiver C Data1 Ack1 Agent B

6 R ELIABLE T RANSMISSION (1/3) Implement the program that… Works as sender and receiver Transmit files by UDP Guarantee reliability Retransmission Time out Sequence number Acknowledge

7 R ELIABLE T RANSMISSION (2/3) SenderReceiver Data1 Ack1

8 R ELIABLE T RANSMISSION (3/3) SenderReceiver Data1 Ack1

9 R EQUIREMENTS (1/4) Implement reliability on UDP socket Both DATA and ACK must be reliable and clearly distinguished The file received is exactly the same as it is sent

10 R EQUIREMENTS (2/4) ACK for acknowledgement FIN for closing the file transmission PSH for data transmission

11 R EQUIREMENTS (3/4) Data packet size : <=1KB File size : more than 0.5MB Time out : < 5sec.

12 R EQUIREMENTS (4/4) Sender and receiver shows message below send, receive, resend, time out, sequence number, DATA, ACK and FIN etc. Sender Receiver

13 A GENT (1/2) Implement an agent that… Drop packets randomly Show loss rate Parse packets and forward to the correct destination

14 A GENT (2/2) SA : A ; DA : BDATA : A → B SA : B ; DA : CDATA : B → C SA : C ; DA : BACK : C → B SA : B ; DA : AACK : B → A Sender A Receiver C Agent B Data1 Ack1

15 R EQUIREMENTS (1/2) Complete the agent Show the accumulated loss rate dropped DATA pkt / total DATA pkt Drop DATA packets only Do not drop ACK packets

16 R EQUIREMENTS (2/2) Sender, receiver and agent shows message below send, receive, resend, time out, sequence number, DATA, ACK and FIN etc. for file transmitter get, forward, drop, DATA, ACK, sequence number, loss rate, etc. Sender A Receiver C Agent B

17 C ONGESTION CONTROL (1/4) Implement congestion control on the transmitter with… Congestion window The number of packet you transmit Buffer for receiver Handling buffer overflow Slow start Threshold Packet loss Retransmission

18 C ONGESTION CONTROL (2/4) Slow start Send single packet in the beginning When below the threshold, congestion window increase exponentially until packet loss i.e. 1 → 2 → 4 → 8 → … When above the threshold, congestion window increase linearly until packet loss i.e. 16 → 17 → 18 → … Default threshold : 16 Default receiver buffer size : 32

19 C ONGESTION CONTROL (3/4)

20 C ONGESTION CONTROL (4/4) Buffer overflow Drop the packet Write to the file if buffer is full as well The following example is 4-buffer with default threshold 2 for demonstration only

21 4-B UFFER E XAMPLE (1/6) Sender Receiver buffer Sender send DATA 1 Congestion window = 1 threshold = 2 Receiver send ACK 1 1 Data1 Ack1

22 4-B UFFER E XAMPLE (2/6) Sender Receiver buffer Sender send DATA 2 & 3 Congestion window = 2 threshold = 2 Receiver send ACK 2 & 3 23 1 Data2 Ack2 Data3 Ack3

23 4-B UFFER E XAMPLE (3/6) Sender Receiver buffer Sender send DATA 4 & 5 & 6 Congestion window = 3 (linear) threshold = 2 Receiver send ACK 4 123 456 Data4 Ack4 Data5 Data6

24 4-B UFFER E XAMPLE (4/6) Sender Receiver buffer Receiver buffer overflow Drop DATA 5 & 6 Flush 123 456 Data5 Data6

25 4-B UFFER E XAMPLE (5/6) Sender Receiver buffer Sender resend DATA 5 Congestion window = 1 threshold = 1 Receiver send ACK 5 5 Data5 Ack5

26 4-B UFFER E XAMPLE (6/6) Sender Receiver buffer Sender resend DATA 6 & send DATA 7 Congestion window = 2 threshold = 1 Receiver send ACK 6 & 7 67 5 Data6 Ack6 Data7 Ack7

27 R EQUIREMENTS (1/2) Complete the transmitter with congestion control Show the accumulated loss rate, window size and threshold Drop DATA packets only Do not drop ACK packets

28 R EQUIREMENTS (2/2) Sender, receiver and agent shows message below Add ignore, drop, flush, window size, threshold, etc. Sender A Receiver C Agent B …

29 F ORMAT R EQUIREMENTS (1/2) Your program should be... Read data from file (i.e. file I/O) Correctly handles error responses The message must follow the format in the previous slide!!

30 F ORMAT R EQUIREMENTS (2/2) Naming b01902xxx_hw2_trans.c ( b01902xxx_hw2_send.c, b01902xxx_hw2_recv.c) b01902xxx_hw2_agent.c Compression tar -zcvf b01902xxx_hw2.tar.gz b01902xxx_hw2/ tar -zcvf b01902xxx_hw2_v2.tar.gz b01902xxx_hw2/ (new version) Upload server FTP server : voip.csie.org account/password : cn2014/cn2014

31 G RADING P OLICIES Reliable transmission - (20%) Agent - (25%) Congestion control - (25%) Clarity of your code (comments!) - (5%) Demo - (15%) Report - (10%) Execution instruction What you do, and how you do it Challenging issues and solutions

32 R EMINDERS Do not cheat! You cheat, you fail! Do not copy source codes from the Internet Read the spec carefully!! Ask TA if you have any question, except for debugging

33 D EADLINE Homework due 2014/12/12 23:59:59 +0800 Start your work as early as possible For late submission - 10% per day

34 HAPPY CODING AGAIN ^o^


Download ppt "C OMPUTER NETWORKING HOMEWORK 2. UDP VS. TCP UDP Unreliable Unordered delivery No congestion control, flow control, connection setup TCP Reliable In-order."

Similar presentations


Ads by Google