辅导CSC424编程语言、 写作program实验

” 辅导CSC424编程语言、 写作program实验CSC424 Computer NetworksECE 534/634 Communication NetworksProject 2: Simple Transport ProtocolYou will design a simple transport protocol that provides reliable datagram service. Your protocol will beresponsible for ensuring that data is delivered in order and without duplicates. Your protocol will betested on an emulated unreliable network.1. RequirementsYou will write two programs: a sending program that sends a file across the network, and a receivingprogram that receives the file and stores it to local disk. It is recommended that your programs are writtenin C on a Linux operating system. You may not use any transport protocol libraries in your project (suchas TCP). You must construct the packets and acknowledgements yourself, and interpret the incomingpackets yourself.Your programs will achieve the following goals: The sender reads a local file and uses your protocol to send it. Transfer the file Contents reliably. The receiver must write the contents it receives into the local directory. Your sender and receiver must gracefully exit. Your code must be able to transfer a file with any number of packets dropped, duplicated, anddelayed.You have to design your own packet format and use UDP as a carrier to transmit packets. Your packetmight include fields for packet type, acknowledgement number, advertised window, data, etc. This part ofthe project is entirely up to you.You have to implement a retransmission protocol to deal with dropped, duplicated, and delayed packets.You may assume that packets are not corrupted so you do not need to implement any error correctioncodes. You must implement at least Stop-and-Wait and Go-Back-N protocols. However, moresophisticated algorithms (for example, selective repeat) will be given bonus credit. Some desiredproperties of your protocol include (but are not limited to): Fast: Require little time to transfer a file. Low overhead: Require low data volume to be exchanged over the network, including data bytes,headers, retransmissions, acknowledgements, etc.Better performance will result in higher points. Remember that network-facing code should be writtendefensively. Your code should check the integrity of every packet received.2. Your programsThe command line syntax for your sending program is given below. The client program takes commandline argument of the remote IP address and port number, and the name of the file to transmit. The syntaxfor launching your sending program is therefore:sendfile recv_host recv_port filenamerecv_host (Required) The IP address of the remote host in a.b.c.d format. (use 127.0.0.1 for localhost)recv_port (Required) The UDP port of the remote host.filename (Required) The name of the file to send.Your sending program should print out messages to the console: When the sender sends a packet for the first time, it should print the following:[send data] start (length)where start is the beginning offset of the file sent in the packet, and length is the amount of thefile sent in that packet. When the sender resends a packet, it should print the following:[resend data] start (length)where start is the beginning offset of the file sent in the packet, and length is the amount of thefile sent in that packet. When the sender Receives an acknowledgement, it should print the following:[recv ack] acknowhere ackno is the acknowledge number You may also print messages of your own depending on your design, but make it concise andreadable.The command line syntax for your receiving program is given below. The server program takes commandline argument of the port number. The syntax for launching your receiving program is therefore:recvfile recv_portrecv_port (Required) The UDP port to listen on.Your receiving program should print out messages to the console: When the receiver receives a valid data packet, it should print:[recv data] start (length) statuswhere status is one of ACCEPTED or IGNORED You may also print messages of your own depending on your design, but make it concise andreadable.Both the sender and The receiver should print out a message after completion of file transfer, and then exit:[completed]3. Testing your codeA. Unreliable networkIn order for you to test your code, you should emulate an unreliable network. To fulfill this task, you willuse netem, which is a simple network packet loss emulation tool in Linux. In order to use netem, you needto install the iproute package through the Ubuntu package manager orsudo apt-get install iprouteOnce iproute is installed you can use the binary tc to delay traffic. Only root can modify a networkinterface so either su to root or use sudo. The following command line gives a simple example in which aconstant 100ms delay is added to outgoing packets of the external interface, eth0. Understand that netemonly adds the delay to packets leaving the interface.sudo tc qdisk add dev eth0 root netem delay 100msTo disable the netem delay products on the interface we can delete the rules.sudo tc qdisk del dev eth0 root netemYour sending and receiving programs probably will run and be tested on a single machine. In this case,you can use lo (Local Loopback) as your device instead of eth0:sudo tc qdisk add dev lo root netem delay 100msA detailed description of the usage of netem can be found at: https://www.linuxfoundation.org/collaborate/workgroups/networking/netemYou will need to Try different configurations of the network by changing: Delay distribution Packet loss rate Packet duplication rate Packet re-ordering rateFor example,sudo tc qdisk add dev eth0 root netem delay 100ms 20ms 25% loss 0.5% duplicate 1% reorder 25% 50%This configuration says: Delay is 100ms 20ms with the next random element depending 25% on the last one. Packet loss rate is 0.5% Packet duplicate rate is 1% 25% of packets (with a correlation of 50%) will get sent immediately, others will be delayed.B. Large filesYour program needs to handle file of any size. To create a dummy file in Linux (Ubuntu), use thecommand line:base64 /dev/urandom | head -c 10000000 file.txtThis creates a file with name file.txt size of 10MB. You can use different configurations to test other filesizes.4. ReportYou will write a report for this project. There is no strict format of this report but below are the essentialparts:1. How you design the packets and your protocol.2. A screen Shot of the console in a successful run of your programs.3. Try different configurations of netem and report the results.4. Evaluate the efficiency of your protocol (e.g. throughput and delay).5. Perform a comparative study of Stop-and-Wait and Go-Back-N.There are other Aspects that you can explore and report, which are up to you. More comprehensive studywill receive more credits.* Do not paste a lot of codes in the report. Focus on the design and analysis. Your codes will be submittedseparately.5. Submitting your projectYou should submit your project in Blackboard. The submission includes: a project report and your sourcecodes. Please put everything in a zip/rar file, name it FirstName_LastName_Project2.zip orFirstName_LastName_Project2.rar6. AdviceStart by Getting your code working without any packet manipulation. You can check whether your codesuccessfully transmits the file by using the diff program in Linux. Test your code with each type ofmanipulation separately and then in combination. Note that you will likely have to introduce multiplereliability mechanisms (timeouts, retransmits, etc) in order to handle all of the possible errors.Start early! Do not Wait until the last few days.如有需要,请加QQ:99515681 或邮箱:99515681@qq.com

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导