Ubuntu下编译安装FFmpeg.doc_第1页
Ubuntu下编译安装FFmpeg.doc_第2页
Ubuntu下编译安装FFmpeg.doc_第3页
Ubuntu下编译安装FFmpeg.doc_第4页
Ubuntu下编译安装FFmpeg.doc_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

一个简单的ns2实验全过程实验名称:比较tcp和udp的丢包行为试验目的:1. 熟练用ns2做网络仿真试验的整个流程;2. 练习写tcl脚本,了解怎么应用http和rtp;3. 练习用awk处理trace数据,了解怎么计算丢包率;4. 练习用gnuplot绘制曲线图,熟练gnuplot的使用。实验步骤:1。确定网络拓扑。 一个简单的三个节点的拓扑,两个运行cbr(const-bitrate)应用的发送结点,一个接收结点。一条链路使用tcp链接,一条链路使用udp连接。如图。2。写tcl脚本。# jiqing 2007-6-5# this script is to compare the loss rates of http and rtp.set ns new Simulator#open a nam trace fileset nf open out.nam w$ns namtrace-all $nf#open a trace fileset tf open out.tr w$ns trace-all $tf#finish procedureproc finish global ns nf tf$ns flush-traceclose $nfclose $tfexec ./nam out.nam &exit 0#create nodesset node(http) $ns nodeset node(rtp) $ns nodeset node(recv) $ns node#create links$ns duplex-link $node(http) $node(recv) 0.9Mb 10ms DropTail$ns duplex-link $node(rtp) $node(recv) 0.9Mb 10ms DropTail#set queue size$ns queue-limit $node(http) $node(recv) 10$ns queue-limit $node(rtp) $node(recv) 10#relayout nodes$ns duplex-link-op $node(http) $node(recv) orient right-down$ns duplex-link-op $node(rtp) $node(recv) orient right-up#set colors$ns color 1 blue$ns color 2 red#set a tcp connectionset tcp new Agent/TCP$ns attach-agent $node(http) $tcpset sink new Agent/TCPSink$ns attach-agent $node(recv) $sink$ns connect $tcp $sink$tcp set fid_ 1#set a cbr above tcp connectionset cbr(http) new Application/Traffic/CBR$cbr(http) attach-agent $tcp$cbr(http) set type_ CBR$cbr(http) set packet_size_ 1000$cbr(http) set rate_ 1mb$cbr(http) set random_ false#set a rtp connectionset rtp new Agent/UDP$ns attach-agent $node(rtp) $rtpset null new Agent/Null$ns attach-agent $node(recv) $null$ns connect $rtp $null$rtp set fid_ 2#set a cbr above tcp connectionset cbr(rtp) new Application/Traffic/CBR$cbr(rtp) attach-agent $rtp$cbr(rtp) set type_ CBR$cbr(rtp) set packet_size_ 1000$cbr(rtp) set rate_ 1mb$cbr(rtp) set random_ false#schedule$ns at 0.1 $cbr(http) start$ns at 0.1 $cbr(rtp) start$ns at 4.0 $cbr(http) stop$ns at 4.0 $cbr(rtp) stop$ns at 4.1 finish$ns run3。仿真。在命令提示符下输入ns http_vs_rtp.tcl,回车。仿真结束,会调用nam演示动画。4。用awk处理trace数据。 awk的语法和c很像,不同的是awk中使用变量不用事先声明。一个awk程序的结构如下面所示:BEGIN.END.可见,程序分为三块,BEGIN只在程序进入时执行一次,END只在程序退出前执行一次。而中间的程序块会在处理每行数据时都执行一次。这里用awk计算tcp和udp连接的丢包率,具体程序如下:BEGIN tcp_droped = 0;udp_droped = 0;last_tcp = -1;last_udp = -1;total_tcp = 0;total_udp = 0;i = 0;action = $1;time = $2;type = $5;seq_no = $11;if(action = + & type = tcp) total_tcp = total_tcp + 1;if(action = + & type = cbr) total_udp = total_udp + 1;if(action=r) if(type=tcp) if(seq_no != last_tcp + 1) tcp_droped = tcp_droped + 1; last_tcp = seq_no; if(type=cbr) if(seq_no != last_udp + 1) udp_droped = udp_droped + 1; last_udp = seq_no; time_pointi = time; if(total_tcp 0) tcp_lossi = tcp_droped / total_tcp * 100; else tcp_lossi = 0; if(total_udp 0) udp_lossi = udp_droped / total_udp * 100; else udp_lossi = 0; i = i + 1; END printf(%.2ft%.2ft%.2fn,0,0,0);for(j=0;j http_rtp.txt,将把printf输出的结果写入http_rtp.txt。参见http_rtp.txt。0.91 6.45 0.000.91 6.45 0.000.92 6.38 0.000.92 6.38 0.000.92 6.38 0.000.93 6.32 0.960.93 6.32 0.960.93 6.32 0.950.94 6.25 0.950.94 6.25 0.940.94 6.25 0.940.95 6.19 0.940.95 6.19 0.930.95 6.19 0.930.95 6.12 0.930.96 6.12 0.93 。5。用gnuplot画图。怎么进入和退出gnuplot?开启xserver(运行startxwin.bat)后,输入gnuplot,将进入交互式的画图。如果要退出,输入quit。http_rtp.txt中有三列数据,分别是时间、tcp丢包率、udp丢包率。怎么控制gnuplot选择其中两列作为x,y轴的数据呢?plot filename using 2将会把第二列作为y轴的数据,第一列默认是x轴的数据。plot filename using 2:3将把第二列作为x轴的数据,第三列作为y轴的数据。怎么在一张图中绘制多条线?多个数据源之间用逗号隔开就可以了,如:plot filename1 using 2, filename2 using 2:3, .怎么把图输出为图片?set terminal gif /设置输出格式set output http_rtp.gif /设置输出文件名replot /输出怎么为图片增加说明?set title title /设置标题set xlabel xlabel /设置x轴说明set ylabel ylabel /设置y轴说明实验中遇到的困难及解决办法:1。问题:不知道怎么使用rtp agent。 解决:找不到关于这方面的资料,先用udp代替。2。问题:不知道怎么使用http 解决:关于http的使用ns-2手册 39.7web cache一节,可供借鉴。但是建立一个http应用比较麻烦,需要http/server, http/client, http/cache。这里用cbr来代替。实验结果:1。当链路带宽设为1mb,tcp和udp速率都为1000时,tcp有丢包现象,udp没有丢包现象,这大概是因为tcp有确认报文,而udp没有的缘故。当把链路带宽都设定为0.9Mb,tcp和udp都有严重的丢

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论