” 辅导CISC 650编程、 写作program程序设计UNIVERSITY OF DELAWAREDEPARTMENT OF COMPUTER INFORMATION SCIENCESCISC 650 / CPEG 651 / ELEG 651: Computer Networks IIProgramming Project 2Due Date: 11 pm on Thursday December 3, 2020This project is an individual assignment and must be done independently by eachstudent. Collaboration with or help from anyone else is not permitted.Important note: Before you start this project, read the accompanying document Project 2 Help, whichcontains important and useful information about this project.This project will build upon the programs you wrote in Project 1 for the client, server, and router. In thisproject, the client will send a text file to the server using the Go-Back-N protocol. As in Project 1, allpackets between the client and server will flow through the router which will simulate errors and packetloss. All your programs must run on the course VM cisc650.cis.udel.edu. For convenience, both thehostname and the port Numbers may be hardcoded into the client, server, and router, but this should be donein such a way that they should be easy to change.As you know, UDP does not provide reliable data transfer, whereas a user transmitting a file would expectthe file to be transferred reliably. In this project, you will implement reliable data transfer with the GoBack-Nprotocol. In practice, UDP does not often lose packets, particularly over short distances or whilecommunicating between processes on the same host. This is why we have built a router that introduceserrors and loss into packets, so you can test your protocol implementation under more realistic conditions.You will use the router program from Project 1 with no modifications. But you will have to modify theclient and server Programs to carry out the requirements of this project.Packet FormatsAll packets in this project will have the same format shown in Figure 1 of Project 1. The meaning of all theheader fields is the same as it was in Project 1.However, there are two types of packets in this project: Data packets are sent by the client to the server and they may have a payload field with 0 – 40bytes of data. The Sequence Number in data packets carries the packet sequence number usedby the Go-Back-N protocol. You should assume that this sequence number starts with 0 andincreases sequentially until 15 after which it wraps back to 0. ACKs are sent by the server to the client and they have a payload field with 0 bytes of data.The Sequence Number in an ACK is the ACK sequence number used by the Go-Back-Nprotocol. As with Data packets, this number must be in the range 0 – 15.General ActionsAs in Project 1, the router is started first, then the server is started, and finally the client. The job of theclient is to send the contents of the input file named data.txt to the server. As the server receives data packetsfrom the client, it stores the received data in an output file named out.txt.The client constructs packets to send to the server by reading one line at a time from the input file. Eachline in the input file contains a sequence of printable characters (no control characters, etc.), with no morethan 39 characters on a line. The contents of each line should be transmitted as a separate packet. Sincedifferent lines may have a different number of characters, this means that different data packets will havedifferent sizes. The newline character read from the file at the end of each line is also transmitted in thepacket. Note that the newline character is different from the C null character; the null charactershould not be transmitted in any of the data packets sent from the client to the server. Also note that youwill never have more than 40 data bytes in a packet including the newline character.The client must read the file one line at a time and send it in a packet before reading the next line. It is notpermissible to read the entire file and store it in the client before transmitting its lines.The client assigns a sequence number to each packet that it transmits. These sequence numbers start with 0and are then incremented for each packet. After sequence number 15, the numbers wrap around to 0 again.Thus they will always be in the range 0 15. The server returns an ACK for each correctly received packetwith the ACK Containing the sequence number of the latest correctly received in-sequence packet, inconformance to the Go-Back-N protocol. Recall that ACKs are cumulative in this protocol.The client uses a window size in the range 1 8 and keeps a copy of all unACKed packets until they getACKed. The client can transmit packets continuously until the window becomes full. After that, it can onlytransmit packets if and when space becomes available in the window due to received ACKs.When the client is finished transmitting all the lines in the data file, and has received ACKs for all of them,it then sends a special last packet signifying End of Transmission. This packet will have a Count of 0 andno data characters. It will have a Sequence Number that is the next sequence number that would have beenused if this Were a valid data packet. It will also have a Checksum of 0. It is important that this packet betransmitted only after the client has received ACKs for all transmitted data packets. The server will nottransmit an ACK for the EOT packet, and the client will not expect any ACK to be returned for it. Theclient program can terminate once this packet has been transmitted. When the server receives the EOTpacket, it also terminates.The server must check if a received data packet is a new packet, in which case the data received is storedin the output file. If it is not a new packet (it is either a duplicate or out-of-sequence), its data is not storedin the output file. An appropriate ACK must be returned in all cases, in accordance with the Go-Back-Nprotocol.The Project 2 Help document provides more details and help on how to implement the Go-Back-N protocolon both the client and the server.Client Configuration ParametersWhen the client Starts, it is given the following configuration parameters by the user: Window Size: An integer between 1 and 8. Timeout: The user enters an integer value n in the range 1-10, and the timeout value is then storedas 10n microseconds. Note that the resultant timeout value should be stored with both seconds andmicroseconds components (see the Help document).These parameters should ideally be provided as command-line arguments when the client is started.Alternatively, the client may prompt the user to enter values for these parameters and then read in thesevalues immediately after startup. It is not acceptable to hard code values for these parameters in your code.Output of your programAt specific places in both your client and server programs, you must print out specific messages. Thesymbol n below refers to the sequence number of the transmitted or received packet (note that thesequence number must always be in the range 0 – 15), the symbol c below refers to the count (numberof data bytes) in the transmitted or received packet, and the symbol s below refers to the total size of thetransmitted or received packet. The total size includes the sizes of both the header and the data, and shouldbe obtained from the return values of the sendto or recvfrom functions, as the case may be.The messages to Be printed by the client are:When a new data packet numbered n is sent by the client:New packet n transmitted with c data bytes and s total bytesWhen a data packet numbered n is retransmitted by the client:Packet n retransmitted with c data bytes and s total bytesWhen a non-corrupt ACK is received with number n:ACK n received with s total bytesWhen a corrupt ACK is received:ACK received with corrupt checksum and s total bytesWhen a timeout expires:Timeout expired for packet numbered nWhen the End of Transmission packet is sent:End of Transmission Packet transmitted with sequence number n and s total bytesThe messages to be printed by the server are:When a new non-corrupt data packet numbered n is received by the server in sequence:New in-sequence packet n received with c data bytes and s total bytesWhen a non-corrupt data packet numbered n is received by the server, but it is a duplicate or outof-sequencepacket:Duplicate packet n received with c data bytes and s total bytesWhen a corrupt Data packet is received by the server:Packet received with corrupt checksum and s total bytesWhen an ACK is transmitted with number n:ACK n transmittedWhen the End of Transmission packet is received:End of Transmission Packet with sequence number n receivedAt the end, Before terminating execution, the following statistics should be printed. Do not include the lastspecial End of Transmission packet in the count of data packets in these statistics.For client:Number of new data packets transmittedTotal number of data packets transmitted (new plus retransmissions)Total number of data bytes transmitted in new packets (this should be the sum of the count fieldsof all transmitted new packets)Total number of ACKs received (both corrupt and non-corrupt)Number of ACKs received that were corruptCount of how many times timeout expiredFor server:Total number of data packets received (both corrupt and non-corrupt)Number of data packets received that were corruptNumber of non-corrupt duplicate or out-of-sequence data packets receivedNumber of non-corrupt new data packets receivedTotal number Of new data bytes received (this should be the sum of the count fields of all receivednon-corrupt new packets)Number of ACKs transmittedTestingThe files test1.txt and test2.txt in the directory /usa/sethi/networks/proj2 on cis650.cis.udel.edu are sampleinput files that may be used by you to test your programs. It is strongly suggested that you first usetest1.txt for all your testing, and only if you have thoroughly debugged your programs, then proceed withusing test2.txt for further testing.It is also suggested that you test your programs in phases using the following client and routerconfiguration parameter values: Window size 1, Timeout value n = 5, Packet and ACK loss rates 0. Window size 4, Timeout value n = 5, Packet and ACK loss rates 0. Window size 1, Timeout value n = 5, Packet loss rate 0.2, ACK loss rate 0. Window size 4, Timeout value n = 5, Packet loss rate 0.2, ACK loss rate 0. Window size 4, Timeout value n = 5, Packet loss rate 0, ACK loss rate 0.2. Window size 4, Timeout value n = 4, Packet loss rate 0.2, ACK loss rate 0.Once you have tested and debugged with the above parameter values, then you should try combinationsof various other values for the parameters. Make sure your program works well under all conditions,because we will Test it out under a variety of different conditions.SubmissionOnce you are ready for submission, create three scripts, one each for the client, the server, and the router.Show the transfer of the file test1.txt with the first set of configuration parameters listed above. The scriptsshould contain a long listing of the directory that contains your files (using ls -l), should show them beingcompiled, then another long listing (using ls -l) of the directory after compilation is complete, a listing ofthe input file (using cat filename) for the client, show the execution of the programs including the programoutputs, and then a listing of the output data file (for the server). Finally, the server script should do a diffon the input and output files.Submit a zipped copy of your project directory. This directory should include all your original source files,the executables, the input and output data files, and the scripts generated by you for your test run.DemoYou will be asked to schedule a time after your submission for a virtual meeting with me over Zoom. Duringthis meeting, I will run your programs under a variety of different loss and error conditions. Part of yourgrade will depend on the results of this demo.GradingYour programs will be graded on correctness, proper output, readability, and documentation. The gradedistribution is as follows:Correctness: 120 pointsProper Output and Testing: 30 pointsReadability and Documentation: 20 pointsPerformance on the Demo: 30 pointsTotal: 200 pointsAs with Project 1, points for documentation will not be awarded lightly; we will be looking for meaningfulvariable and function names, good use of comments, good modular structure with appropriate use offunctions, Good programming style, and proper indentation.No late Assignments will be accepted, because we will have to schedule times for the demos.如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。