您好,欢迎访问三七文档
网络实验报告一——数据链路层协议的设计与实现计83班981361同志强[实验目的]计算机网络的数据链路层协议保证通信双方在有差错的通信线路上进行无差错的数据传输,是计算机网络各层协议中通信控制功能最典型的一种协议。本实验实现一个数据链路层协议的数据传送部分,目的在于使学生更好地理解数据链路层协议中的“滑动窗口”技术的基本工作原理,掌握计算机网络协议的基本实现技术。[实验内容]在一个数据链路层的模拟实现环境中,用C语言实现下面两个数据链路层协议。(1)“退回到N重发”的滑动窗口协议(参考文献[1]第四章的协议5);(2)“选择重发”的滑动滑动窗口协议(参考文献[1]第四章的协议6);[实验原理,过程以及分析]首先,我们来分析一下试验原理和所得到的数据,从以下的数据我们不难分析出以下的结论:Protocol5.Events:10000Parameters:1002030Process1:Totaldataframessent:802Dataframeslost:162Dataframesnotlost:640Framesretransmitted:679Goodackframesrec'd:0Badackframesrec'd:0Gooddataframesrec'd:429Baddataframesrec'd:201Payloadsaccepted:129Totalackframessent:0Ackframeslost:0Ackframesnotlost:0Timeouts:97Acktimeouts:0Process0:Totaldataframessent:807Dataframeslost:177Dataframesnotlost:630Framesretransmitted:672Goodackframesrec'd:0Badackframesrec'd:0Gooddataframesrec'd:444Baddataframesrec'd:193Payloadsaccepted:117Totalackframessent:0Ackframeslost:0Ackframesnotlost:0Timeouts:96Acktimeouts:0Efficiency(payloadsaccepted/datapktssent)=15%Endofsimulation.Time=10000Protocol6.Events:10000Parameters:1002030Process1:Totaldataframessent:539Dataframeslost:119Dataframesnotlost:420Framesretransmitted:296Goodackframesrec'd:13Badackframesrec'd:8Gooddataframesrec'd:302Baddataframesrec'd:132Payloadsaccepted:202Totalackframessent:34Ackframeslost:6Ackframesnotlost:28Timeouts:296Acktimeouts:34Process0:Totaldataframessent:557Dataframeslost:123Dataframesnotlost:434Framesretransmitted:315Goodackframesrec'd:20Badackframesrec'd:8Gooddataframesrec'd:300Baddataframesrec'd:120Payloadsaccepted:206Totalackframessent:25Ackframeslost:4Ackframesnotlost:21Timeouts:315Acktimeouts:25Efficiency(payloadsaccepted/datapktssent)=37%Endofsimulation.Time=10000Protocol5.Events:10000Parameters:2002030Process1:Totaldataframessent:415Dataframeslost:89Dataframesnotlost:326Framesretransmitted:343Goodackframesrec'd:0Badackframesrec'd:0Gooddataframesrec'd:237Baddataframesrec'd:101Payloadsaccepted:73Totalackframessent:0Ackframeslost:0Ackframesnotlost:0Timeouts:49Acktimeouts:0Process0:Totaldataframessent:415Dataframeslost:77Dataframesnotlost:338Framesretransmitted:336Goodackframesrec'd:0Badackframesrec'd:0Gooddataframesrec'd:218Baddataframesrec'd:108Payloadsaccepted:65Totalackframessent:0Ackframeslost:0Ackframesnotlost:0Timeouts:48Acktimeouts:0Efficiency(payloadsaccepted/datapktssent)=16%Endofsimulation.Time=10000Protocol5.Events:10000Parameters:2002030Process1:Totaldataframessent:415Dataframeslost:89Dataframesnotlost:326Framesretransmitted:343Goodackframesrec'd:0Badackframesrec'd:0Gooddataframesrec'd:237Baddataframesrec'd:101Payloadsaccepted:73Totalackframessent:0Ackframeslost:0Ackframesnotlost:0Timeouts:49Acktimeouts:0Process0:Totaldataframessent:415Dataframeslost:77Dataframesnotlost:338Framesretransmitted:336Goodackframesrec'd:0Badackframesrec'd:0Gooddataframesrec'd:218Baddataframesrec'd:108Payloadsaccepted:65Totalackframessent:0Ackframeslost:0Ackframesnotlost:0Timeouts:48Acktimeouts:0Efficiency(payloadsaccepted/datapktssent)=16%Endofsimulation.Time=10000Protocol6.Events:10000Parameters:2004030Process1:Totaldataframessent:253Dataframeslost:115Dataframesnotlost:138Framesretransmitted:171Goodackframesrec'd:7Badackframesrec'd:6Gooddataframesrec'd:116Baddataframesrec'd:38Payloadsaccepted:80Totalackframessent:7Ackframeslost:2Ackframesnotlost:5Timeouts:171Acktimeouts:7Process0:Totaldataframessent:262Dataframeslost:108Dataframesnotlost:154Framesretransmitted:170Goodackframesrec'd:5Badackframesrec'd:0Gooddataframesrec'd:97Baddataframesrec'd:41Payloadsaccepted:69Totalackframessent:19Ackframeslost:6Ackframesnotlost:13Timeouts:170Acktimeouts:19Efficiency(payloadsaccepted/datapktssent)=28%Endofsimulation.Time=10000Protocol6.Events:10000Parameters:2002070Process0:Totaldataframessent:217Dataframeslost:44Dataframesnotlost:173Framesretransmitted:190Goodackframesrec'd:2Badackframesrec'd:10Gooddataframesrec'd:46Baddataframesrec'd:131Payloadsaccepted:27Totalackframessent:13Ackframeslost:1Ackframesnotlost:12Timeouts:190Acktimeouts:13Process1:Totaldataframessent:218Dataframeslost:41Dataframesnotlost:177Framesretransmitted:186Goodackframesrec'd:4Badackframesrec'd:8Gooddataframesrec'd:44Baddataframesrec'd:129Payloadsaccepted:22Totalackframessent:14Ackframeslost:2Ackframesnotlost:12Timeouts:186Acktimeouts:14Efficiency(payloadsaccepted/datapktssent)=11%Endofsimulation.Time=100001.由两协议的原理我们也可分析出不同之处:1)由于协议6要存储后续的帧,所以它要用的buffer也就要多一些。2)协议5的接受窗口为1,而协议6的窗口则为:(max_seq+1)/2.2.在一般的情况下,协议6的效率要比协议5的效率高。这个我们可以从原理上来分得到此结论:1)对于协议5,当出现错误时,接受过程直接抛弃所有后续的帧,当发送过程时间到,在重发后续的未经确认的帧;但是对于协议6,当出现错误时,接受方的数据连路层存储后续所有正确的帧,第二次之重发出现错误的帧。重发的帧就少了,所以效率也就上去了。2)协议6多了一个辅助计时器,当一个按序列号发的数据帧到达后,启动它,如当超时前无反向的通讯后,发送一个单独的确认帧。3)在协议6中多加了一个否定确认帧,当一旦接受过程有理由怀疑出现差错,就发出它。所以,我们得到了此结论。3.在协议5种,当timeout有小变大时,其效率有小变大,再变小;这是因为当timeout很小时,一直重发,当它很大时,则等的时间变长。而在协议6中,timeout变大时,其效率变小。4.对于协议5,6中的任何一个,当出错率和丢包率变大时,效率都变小。但出错率的协议5的影响相对来说大些,这是因为它重发的帧更多些。[小结]本次试验相对来说比较简单,它使我明白了活动窗口协议的原理和实现。通过两个协议的比较,得出它们的不同点,从而得出一个相对更好的!
本文标题:网络实验报告一
链接地址:https://www.777doc.com/doc-5923498 .html