” CSc361留学生程序 写作、Python编程 辅导、Programming语言 写作CSc361 Fall 2020 Programming Assignment 2 (P2): Reliable Datagram Protocol (RDP) SpecificationSpec Out: by Wednesday, October 7, 2020Code Due: by Friday, October 30, 2020, 5pm through connex.csc.uvic.caObjective: In this programming assignment, you will use the DATAGRAM socket (i.e., supported by UDP) inPython to create a Reliable Datagram Protocol (RDP) transceiver (rdp.py, a combined sender and receiver)running on H1 in PicoNet, to interact with a given echo server running on H2, over an unreliable link at R.Schedule: There are four tutorials (T5, T6, T7 and T8) and three lab sessions (L5, L6 and L7) associated withthis assignment.In T5 on October 9, the tutorial instructor will go through the P2 specification and answer possible questions,so please read P2 spec carefully beforehand.In L5 on October 13 or 14, the lab instructor will go through TCP connection management and flow controlpacket capture and analysis, and help students form their design for P2.In T6 on October 16, the tutorial instructor will check students P2 design on RDP connection management andflow control, and provide feedback and instruction on how to test P2 in PicoNet with network impairments.In L6 on October 20 or 21, the lab instructor will go through TCP error control, check students P2implementation on connection management and flow control, capture and analyze RDP packets, and providehelp if needed.In T7 on October 23, the tutorial instructor will check students P2 design on RDP error control, and providefeedback and instruction on submission.In L7 on October 27 or 28, the lab instructor will go through TCP congestion control, and check students P2implementation on RDP error control, capture and analyze RDP packets, and provide help if needed.In T8 on October 30, the tutorial instructor will provide some last-minute reminders and help.Please follow our tutorial and lab schedule very closely for this assignment, which ensures its success andsmoothness.Requirements: A basic RDP design is provided, and you can extend the design as you see fit. RDP followsHTTP design, using full text, line-by-line control headers to establish (SYN) and release (FIN) connection, andSequence number in data (DAT) packet of PAYLOAD Length and Acknowledgment number inacknowledgment (ACK) packet to reorder out-of-order packets, acknowledge received packets and identify lostpackets for retransmission. To be efficient, RDP cannot use stop-and-wait (i.e., transmit a packet, wait foracknowledgment, and retransmit until it is received), and has to support flow control using Window size (i.e.,multiple packets can be transmitted back-to-back within the Window, and lost packets will be recoveredthrough retransmission by timeout or three duplicate acknowledgments). You can model your RDP design afterTCP, but you do not need to implement the entire TCP. Congestion control is not needed for RDP in P2.RDP packet formatCOMMANDHeader: ValueHeader: ValuePAYLOADwhere, COMMAND := SYN|FIN|DAT|ACK|RST, and SYN indicates to establish connection, FIN to closeconnection, RST to reset connection, DATA to send data, and ACK to acknowledge received data.Header := Sequence|Acknowledgment|Window|Length, and Sequence provides the sequence numberassociated with the packet (the first byte of the PAYLOAD if any), Acknowledgment the sequence numberexpected by the receiver (the next byte of the PAYLOAD if any), Window the size of the receivers window inbytes, and Length the length of the PAYLOAD in bytes. Note that an empty line indicates the end of headers.PAYLOAD, if existing, is the actual data sent from the sender to the receiver. PAYLOAD is at most 1024 bytes.The Echo ServerOn H2mkfifo fifowhich makes a FIFO (named pipe) called fifo. you only need to run this command once at /home/jovyanThencat fifo | nc -u -l 8888 fifowhich runs nc (netcat) in UDP server mode at port 8888, redirects output to fifo, and pipes through fifo to nc.To test the echo server, on H1nc -u h2 8888and type any input—it will be echoed back by H2 and shown on H1. Use tcpdump on Rtcpdump -n -l -i r-eth1 udp port 8888to verify it.Connection ManagementThe RDP sender sends SYN first to establish the connection with the RDP receiver, and the RDP receiversends ACK to accept the connection. Note that RDP is unidirectional from the sender to receiver, so thereceiver does not need to send SYN. After the data transfer finished, the RDP sender sends FIN to close theconnection, which is acknowledged by the RDP receiver with ACK. Please note that COMMAND, Headers andPAYLOAD are all case sensitive. For unrecognized or incompatible COMMAND and Headers (e.g., DATpackets missing Sequence number and Length, ACK packets missing Acknowledgment number and Window,and so on), RDP will reset the connection with RST, and there is no ACK for RST.Data TransferOnce connected, the RDP sender can send DAT (data) packets to the receiver, each with a Sequence numberheader indicating the sequence number of the first bytes of the PAYLOAD, and Length indicating the size ofthe PAYLOAD in bytes. The RDP receiver will acknowledge the received DAT packets cumulatively, using theAcknowledgment header indicating the first byte expected in the next PAYLOAD.How to emulate Internet delayOn R,tc qdisc add dev r-eth1 root netem delay 100mswill add 100 millisecond delay at the output queue of r-eth1.Flow ControlThe RDP receiver will advertise its receiver window in ACK packets with the Window header. The RDP sendershall respect the Window size and shall not send any data with sequence number equal to or aboveAcknowledgment+Windows.How to emulate Internet delay and lossOn Rtc qdisc change dev r-eth1 root netem delay 100ms loss 25%after the above command will add 100 millisecond delay and set 25% packet loss at the output queue of r-eth1.Error ControlOnce packet loss occurs, the RDP sender and receiver may miss SYN, FIN, DAT or ACK packets, so errorcontrol is needed. The RDP receiver shall acknowledge received packet cumulatively, and the sender willretransmit unacknowledged packets when timeout or after receiving enough duplicate acknowledgments.How to run RDPpython3 rdp.py ip_address port_number read_file_name write_file_nameon H1 will bind rdp to ip_address and port_number to send or receive UDP packets, and to transfer a file withread_file_name from the RDP sender to receiver saved with write_file_name. After the file transfer is finished,diff read_file_name write_file_nameon H1 can tell you whether the received file is different from the sent file of length greater than 10,240 bytes.What RDP outputsIn addition to saving the received file for diff, RDP shall also output a log to the screen in the following formatDATE: EVENT; COMMAND; Sequence|Acknowledgment: Value; Length|Window: Valuewhere DATE is timestamp and EVENT := Send|Receive. For example,Fri Oct 2 16:54:09 PDT 2020: Send; SYN; Sequence: 0; Length: 0Fri Oct 2 16:54:09 PDT 2020: Receive; SYN; Sequence: 0; Length: 0Fri Oct 2 16:54:09 PDT 2020: Send; ACK; Acknowledgment: 1; Window: 2048Fri Oct 2 16:54:09 PDT 2020: Receive; ACK; Acknowledgment: 1; Window: 2048Fri Oct 2 16:54:09 PDT 2020: Send; DAT; Sequence: 1; Length: 1024Fri Oct 2 16:54:10 PDT 2020: Receive; DAT; Sequence: 1; Length: 1024Fri Oct 2 16:54:10 PDT 2020: Send; ACK; Acknowledgment: 1025; Window: 1024Fri Oct 2 16:54:10 PDT 2020: Receive; ACK; Acknowledgment: 1025; Window: 1024Fri Oct 2 16:54:10 PDT 2020: Send; FIN; Sequence: 1025; Length: 0Fri Oct 2 16:54:10 PDT 2020: Receive; FIN; Sequence: 1025; Length: 0Fri Oct 2 16:54:10 PDT 2020: Send; ACK; Acknowledgment: 1026; Window: 2048Fri Oct 2 16:54:10 PDT 2020: Receive; ACK; Acknowledgment: 1026; Window: 2048where the RDP sender sends a SYN packet with Sequence number 0, which is received by the RDP receiver,and the RDP receiver sends ACK to accept with Acknowledgment number 1 and Window size 2048 bytes.Next, the RDP sender sends a DAT packet with Sequence number 1 and payload Length 1024 bytes, which isreceived by the RDP receiver and acknowledged with an ACK packet with Acknowledgment number 1025 andWindows size 1024 bytes. The sender then closes the connection by sending a FIN packet with Sequencenumber 1025, which is acknowledged by the receiver with Acknowledgment number 1026, so the connection isclosed. Please note that this example just illustrates a very simple case of transferring 1024 bytes reliably.How to test and evaluate RDPRun the echo server on H2, run tcpdump on R to capture the interaction between H1 and H2, and run rdp.pyon H1. It is very important to correlate the packet exchange between H1 and H2 and the endpoint reaction atH1 for both the RDP sender and receiver through the RDP log, which can help you debug your code as well.Although RDP sender and receiver are in the same rdp.py on H1, RDP protocol and logic cannot be bypassed.What to submit: rdp.py source file, and the tcpdump files on R, showing the interaction between H1 and H2.Please also copypaste the content of rdp.py and tcpdump -r the capture file to the text input box on connex.When: by Friday, October 30, 2020, 5pm through connex – assignments – p2Questions and answers (Please read P2 Spec carefully first): connex – forums – p2Academic integrity: This is an individual assignment so your submitted work shall be done by yourself alone.如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。