NS2网络模拟(5)-homework01.tcl

简介: 1: #NS2_有线部分\homework01.tcl 2: 3: #创建两个结点,深圳到北京的TCP连接,图形将数据显示出来,计算吞吐率,画图分析 4: #tcp上层用ftp 5: #udp上层用cbr 6: #Create a simula...
  1: #NS2_有线部分\homework01.tcl
  2: 
  3: #创建两个结点,深圳到北京的TCP连接,图形将数据显示出来,计算吞吐率,画图分析
  4: #tcp上层用ftp
  5: #udp上层用cbr
  6: #Create a simulator object
  7: set ns [new Simulator]
  8: 
  9: set nf [open SZ2BJ.nam w]
 10: $ns namtrace-all $nf
 11: 
 12: set nd [open SZ2BJ.tr w]
 13: $ns namtrace-all $nd
 14: 
 15: proc finish {} {
 16:     global ns nf nd
 17:     $ns flush-trace
 18:     close $nf
 19:     close $nd
 20:     exec nam SZ2BJ.nam &
 21:     exit 0
 22: }
 23: 
 24: 
 25: #$ns node-config     -addressType    hierarchical
 26:                                     
 27: #Create two nodes
 28: set Node_Shenzhen [$ns node]
 29: $Node_Shenzhen color red
 30: $Node_Shenzhen shape hexagon
 31: #$Node_Shenzhen label "ShenZhen"
 32: 
 33: set Node_Beijing  [$ns node]
 34: $Node_Beijing color red
 35: #$Node_Beijing lable "BeiJing"
 36: #Create a duplex link between the nodes
 37: $ns duplex-link $Node_Shenzhen $Node_Beijing 1Mb 500ms DropTail
 38: 
 39: #$ns queue-limit $2 $n3 10
 40: 
 41: #TCP
 42: set Agent_Sender [new Agent/TCP]
 43: $Agent_Sender set class_    2
 44: $Agent_Sender set addr_     192.168.1.100
 45: $Agent_Sender set dst_addr- 192.168.1.200
 46: $Agent_Sender set size_     1492
 47: $Agent_Sender set defttl_   256
 48: $ns attach-agent $Node_Shenzhen $Agent_Sender
 49: 
 50: set Agent_Receiver [new Agent/NULL]
 51: $ns attach-agent $Node_Beijing $Agent_Receiver
 52: 
 53: $ns connect $Agent_Sender $Agent_Receiver
 54: 
 55: #Simulated Application
 56: set App_Ftp [new Application/FTP]
 57: $App_Ftp attach-agent $Agent_Sender
 58: 
 59: 
 60: #start and stop FTP
 61: $ns at 1.0 "App_Ftp start"
 62: $ns at 4.0 "App_Ftp stop"
 63: 
 64: $ns at 5.0 "finish"
 65: 
 66: $ns run
 67: 
相关文章
NS2网络性能参数分析
NS2下trace文件分析网络性能参数-zhenhuaqin-ChinaUnix博客 http://blog.chinaunix.net/uid-21411227-id-1826744.html
863 0
NS2网络模拟(1)-延迟
1: #NS2_有线部分\EndDelay.awk 2: 3: BEGIN { 4: #Initialize the variable 5: MaxID = 0; 6: i = 0; 7: } ...
742 0
|
网络协议
NS2网络模拟(2)-丢包率
1: #NS2_有线部分\LossRate.awk 2: 3: BEGIN { 4: #Initialize the variable 5: Lost = 0; #the Sum of Lost packet 6: ...
1018 0
NS2网络模拟(3)-吞吐率
1: #NS2_有线部分\Throughput.awk 2: 3: BEGIN { 4: #Initialize the variable 5: init = 0; 6: i = 0; 7: } 8:...
766 0
NS2网络模拟(4)-吞吐率图
1: #NS2_有线部分\ForGnuplot.plot 2: 3: #gnuplot> 4: #set xtics 0, 1, 10 5: set grid 6: set xrange [0:10] 7: set yrange [0...
732 0
NS2网络模拟(6)-homework02.tcl
1: #NS2_有线部分\homework02.tcl 2: 3: #Create a simulator object 4: set ns [new Simulator] 5: 6: #Define different colors for...
1345 0
|
网络协议
NS2网络模拟(7)-homework03.tcl
1: #NS2_有线部分\homework03.tcl 2: 3: #Create a simulator object 4: set ns [new Simulator] 5: 6: #Define different colors for...
839 0
|
1月前
|
机器学习/深度学习 数据采集 人工智能
m基于深度学习网络的手势识别系统matlab仿真,包含GUI界面
m基于深度学习网络的手势识别系统matlab仿真,包含GUI界面
38 0
|
1月前
|
机器学习/深度学习 算法 计算机视觉
基于yolov2深度学习网络的火焰烟雾检测系统matlab仿真
基于yolov2深度学习网络的火焰烟雾检测系统matlab仿真
|
1月前
|
机器学习/深度学习 算法 计算机视觉
m基于深度学习网络的性别识别系统matlab仿真,带GUI界面
m基于深度学习网络的性别识别系统matlab仿真,带GUI界面
29 2

热门文章

最新文章