📄 ex-lan.tcl
字号:
# Author: Jae Chung# Date: 7/20/99## This file is modified from # "ns-2/tcl/ex/lantest.tcl"set opt(tr) "out.tr"set opt(namtr) "out.nam"set opt(seed) 0set opt(stop) 5set opt(node) 8set opt(qsize) 100set opt(bw) 10Mbset opt(delay) 1msset opt(ll) LLset opt(ifq) Queue/DropTailset opt(mac) Mac/Csma/Caset opt(chan) Channelset opt(tcp) TCP/Renoset opt(sink) TCPSinkset opt(app) FTPproc finish {} { global ns opt trfd ntrfd $ns flush-trace close $trfd close $ntrfd exec nam $opt(namtr) & exit 0}proc create-trace {} { global ns opt set trfd [open $opt(tr) w] $ns trace-all $trfd return $trfd}proc create-namtrace {} { global ns opt set ntrfd [open $opt(namtr) w] $ns namtrace-all $ntrfd}proc create-topology {} { global ns opt global lan node source node0 set num $opt(node) for {set i 0} {$i < $num} {incr i} { set node($i) [$ns node] lappend nodelist $node($i) } set lan [$ns newLan $nodelist $opt(bw) $opt(delay) \ -llType $opt(ll) -ifqType $opt(ifq) \ -macType $opt(mac) -chanType $opt(chan)] set node0 [$ns node] $ns duplex-link $node0 $node(0) 2Mb 2ms DropTail $ns duplex-link-op $node0 $node(0) orient right}## MAIN ##set ns [new Simulator]set trfd [create-trace]set ntrfd [create-namtrace]create-topologyset tcp0 [$ns create-connection TCP/Reno $node0 TCPSink $node(7) 0]$tcp0 set window_ 15set ftp0 [$tcp0 attach-app FTP]$ns at 0.0 "$ftp0 start"$ns at $opt(stop) "finish"$ns run
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -