?? vlantest-flat.tcl
字號:
puts "sourcing tcl/lan/vlan.tcl..."source ../lan/vlan.tclset opt(tr) outset opt(namtr) "vlantest-flat.nam"set opt(seed) 0set opt(stop) .5set opt(node) 4set opt(qsize) 100set opt(bw) 10Mbset opt(delay) 1msset opt(ll) LLset opt(ifq) Queue/DropTailset opt(mac) Mac/Csma/Cdset opt(chan) Channelset opt(tcp) TCP/Renoset opt(sink) TCPSinkset opt(app) FTPproc finish {} { global ns opt $ns flush-trace exec nam $opt(namtr) & exit 0}proc create-trace {} { global ns opt if [file exists $opt(tr)] { catch "exec rm -f $opt(tr) $opt(tr)-bw [glob $opt(tr).*]" } set trfd [open $opt(tr) w] $ns trace-all $trfd if {$opt(namtr) != ""} { $ns namtrace-all [open $opt(namtr) w] } return $trfd}proc create-topology {} { global ns opt global lan node source node0 nodex set num $opt(node) for {set i 0} {$i < $num} {incr i} { set node($i) [$ns node] lappend nodelist $node($i) } set lan [$ns make-lan $nodelist $opt(bw) \ $opt(delay) $opt(ll) $opt(ifq) $opt(mac) $opt(chan)] set node0 [$ns node] $ns duplex-link $node0 $node(1) 20Mb 2ms DropTail $ns duplex-link-op $node0 $node(1) orient right set nodex [$ns node] $ns duplex-link $nodex $node(2) 20Mb 2ms DropTail $ns duplex-link-op $nodex $node(2) orient left}## MAIN ##set ns [new Simulator]set trfd [create-trace]create-topologyset tcp0 [$ns create-connection TCP/Reno $node0 TCPSink $nodex 0]$tcp0 set window_ 15set ftp0 [$tcp0 attach-app FTP]#set udp0 [new Agent/UDP]#$ns attach-agent $node0 $udp0#set cbr0 [new Application/Traffic/CBR]#$cbr0 attach-agent $udp0#set rcvr0 [new Agent/Null]#$ns attach-agent $nodex $rcvr0#$udp0 set dst_ [$rcvr0 set addr_]$ns at 0.0 "$ftp0 start"#$ns at 0.0 "$cbr0 start"$ns at $opt(stop) "finish"$ns run
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -