Part C (50 marks)The RUSH protocol (Reliable UDP Substitute for HTTP) is a HTTP-like stop-and-wait protocol that uses UDPin conjunction with the RDT rules. You have recently been hired by the multinational tech giant COMS3200 Inc,who have identified your deep knowledge in the field of transport-layer protocols. The CEO of COMS3200 Inc, DanKim, has asked you to develop a network server capable of sending RUSH messages to a client. It is expected thatthe RUSH protocol is able to handle packet corruption and loss according to the RDT rules. Your server programmust be written in Python, Java, C, or C++.ASIDE: The RUSH protocol is not a real networking protocol and has been created purely for this assignmentProgram InvocationYour program should be able to be invoked from a UNIX command line as follows. It is expected that any Pythonprograms can run with version 3.6, and any Java programs can run with version 8.Pythonpython3 assign2.pyC/C++make./assign2Javamakejava Assign2RUSH Packet StructureA RUSH packet can be expressed as the following structure (|| is concatenation):IP-header || UDP-header || RUSH-header || payloadThe data segment of the packet is a string of ASCII plaintext. Single RUSH packets must be no longer than 1500bytes, including the IP and UDP headers (i.e. the maximum length of the data section is 1466 bytes). Packets thatare smaller than 1500 bytes should be padded with 0 bits up to that size. The following table describes the headerstructure of an RUSH packet:Bit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 150 Sequence Number16 Acknowledgement Number32 Flags Reserved (should be 0)The following sections describe each header in this packet further.3Sequence and Acknowledgement NumbersSequence numbers are independently maintained by the client and server. The first packet sent by either endpointshould have a sequence number of 1, and subsequent packets should have a sequence number of 1 higher than theprevious packet (note that unlike TCP, RUSH sequence numbers are based on the number of packets as opposedto the number of bytes). When the ACK flag is set, the acknowledgement number should contain the sequencenumber of the packet that is being acknowledged. When a packet is retransmitted, it should use the originalsequence number of the packet being retransmitted. Any packet that isn’t a retransmission (including NAKs)should increment the sequence number.FlagsThe Flags section of the header is broken down into the following:Bit 0 1 2 3 40 ACK NAK GET DAT FINThe purpose of these flags is described in the example below.RUSH ExampleThe following situation describes a simple RUSH communication session. Square brackets denote the flags that areset in each step (for example [FIN/ACK] denotes the FIN and ACK flags having the value 1 and the rest havingthe value 0). Note that RUSH, unlike TCP, is not connection-oriented. There is no handshake to initialise theconnection, but there is one to close the connection.1. The client sends a request packet to the server [GET] The sequence number of this packet will always be 1 The data section of this packet will contain the name of a resource (eg. file.txt)2. The server transmits the requested resource to the client over (possibly) multiple packets [DAT] The first packet should have a sequence number of 13. The client acknowledges having received each data packet [DAT/ACK] The acknowledgement number of this packet should be the sequence number of the packet being acknowledged4. After receiving the last acknowledgement, the server signals the end of the connection [FIN]5. The client acknowledges the connection termination [FIN/ACK]6. The server acknowledges the client’s acknowledgement and terminates the connection [FIN/ACK]4Your TaskBasic Server Functionality (10 marks)To receive marks in this section you need to have a program that is able to: Listen on an unused port for a client’s message Successfully close the connectionWhen invoked, your program should let the OS choose an unused localhost port and your program should listenon that port. It should output that port as a raw base-10 integer to stdout. For example, if Python was used andport 54321 was selected, your program invocation would look like this:python3 assign2.py54321Any lines in stdout after the port number can be used for debugging. For this section, your program does notneed to respond to the GET request. Upon hearing from a client, your program can immediatel代做COMS3200作业、代写Python, Java, C/C++程序作业、HTTP-like留学生作业代写 帮做Hay signal the end ofthe connection (as described in the example). Once the FIN handshake has been completed, your program shouldterminate.You may always assume that only one client will connect to the server at a time. For this section and the next youmay also assume that no packets are corrupted or lost during transmission.File Transmission (10 marks)To receive marks in this section you need to have a program that is able to: Perform all features outlined in the above section Successfully transmit a requested file over one or more packets Receive (but not handle) ACKs from the client during transmissionWhen your server receives a GET packet, it should locate the file being requested and return the file’s contentsover one or more DAT packets. When complete, the server should close the connection (as in the above section).You may assume that the file being requested always exists (it is expected that this file is stored in your program’sworking directory).Retransmission (15 marks)To receive marks in this section you need to have a program that is able to: Perform all features outlined in the above sections Retransmit any packet on receiving a NAK for that packet Retransmit any packet that has not been acknowledged within 3 seconds of being sentA client will send a DAT/NAK packet should it receive a corrupted packet or a packet with a sequence number itwasn’t expecting (the NAK packet’s acknowledgement number will contain the sequence number it was expecting).In this case your program should retransmit the packet with that sequence number.If a DAT, FIN, or ACK packet gets lost during transmission your program should retransmit it after 3 secondswithout acknowledgement. If a NAK is received the timer should reset. How you choose to handle timeouts is upto you, however it must work on a UNIX machine (moss). Achieving this through multithreading, multiprocessing,or signals is fine provided you only use standard libraries.5Packet Corruption (15 marks)To receive marks in this section you need to have a program that is able to: Perform all features outlined in the above sections Gracefully ignore corrupt, invalid, or unexpected packetsWhen a corrupt, invalid, or unexpected packet is received, your program should ignore it and continue to runwithout error. Any retransmission timer should also not stop or reset. Part of this task is determining what wouldconstitute as an invalid or unexpected packet. You can assume that the only legal flag combinations are GET,DAT, DAT/ACK, DAT/NAK, FIN, and FIN/ACK. You don’t have to worry about checking the UDP checksum -only the contents of the RUSH header and data.Tips for Success Revisit the lectures and labs on reliable data transfer and TCP, ensuring you are familiar with the fundamentals Frequently test your code on moss Ensure your base functionality is working before attempting the more difficult tasks Start early - there will be limited help during the midsemester break so any questions will need to be askedin labs beforehandLibrary Restrictions The only communication libraries you may use are standard socket libraries which open UDP sockets You can’t use any libraries that aren’t considered standard for your languagei.e. if you have to download alibrary to use it it would be considered as non-standard) If you are unsure about whether you may use a certain library, please ask the course staff on PiazzaSubmissionSubmit all files necessary to run your program. At a minimum, you should submit a file named assign2.py,assign2.c, assign2.cpp or Assign2.java. If you submit a C/C++ or Java program, you should also submit amakefile to compile your code into a binary named assign2 or a .class file named Assign2.class.IMPORTANT: If you do not adhere to this (eg. submitting a C/C++/Java program without a Makefile, or a.class file instead of a .java file), you will receive 0 for this part of the assignment.MarkingYour code will be automatically marked on a UNIX machine, so it is essential that your program’s behaviour isexactly as specified above. Your program should complete all tasks within a reasonable time frame (for example asingle packet should not take more than one second to construct and send) - there will be timeouts on all tests andit is your responsibility to make sure your code is not overly inefficient. It is expected that you will receive a smallsample of tests and a basic RUSH client program before the submission deadline.There are no marks for coding style.6转自:http://ass.3daixie.com/2019042722062438.html