⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex-mcast.tcl

📁 用于在ns2下仿真局域网的脚本文件,里面有详细的设置步骤
💻 TCL
字号:
# Polly Huang 8-7-98set ns [new Simulator]$ns multicastset f [open out.tr w]$ns trace-all $f$ns namtrace-all [open out.nam w]$ns color 1 red# prune/graft packets$ns color 30 purple$ns color 31 greenset n0 [$ns node]set n1 [$ns node]set n2 [$ns node]set n3 [$ns node]# Use automatic layout $ns duplex-link $n0 $n1 1.5Mb 10ms DropTail$ns duplex-link $n1 $n2 1.5Mb 10ms DropTail$ns duplex-link $n1 $n3 1.5Mb 10ms DropTail$ns duplex-link-op $n0 $n1 orient right$ns duplex-link-op $n1 $n2 orient right-up$ns duplex-link-op $n1 $n3 orient right-down$ns duplex-link-op $n0 $n1 queuePos 0.5set mrthandle [$ns mrtproto DM {}]set cbr0 [new Application/Traffic/CBR]set udp0 [new Agent/UDP]$cbr0 attach-agent $udp0$ns attach-agent $n1 $udp0$udp0 set dst_ 0x8001set cbr1 [new Application/Traffic/CBR]set udp1 [new Agent/UDP]$cbr1 attach-agent $udp1$udp1 set dst_ 0x8002$udp1 set class_ 1$ns attach-agent $n3 $udp1set rcvr [new Agent/LossMonitor]#$ns attach-agent $n3 $rcvr$ns at 1.2 "$n2 join-group $rcvr 0x8002"$ns at 1.25 "$n2 leave-group $rcvr 0x8002"$ns at 1.3 "$n2 join-group $rcvr 0x8002"$ns at 1.35 "$n2 join-group $rcvr 0x8001"$ns at 1.0 "$cbr0 start"$ns at 1.1 "$cbr1 start"$ns at 2.0 "finish"proc finish {} {	global ns	$ns flush-trace	puts "running nam..."	exec nam out.nam &	exit 0}$ns run

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -