Tutorial: loop.ns

File loop.ns, 414 bytes (added by stoller, 4 years ago)
Line 
1 # This is a simple ns script that demonstrates loops.
2 set ns [new Simulator]                 
3 source tb_compat.tcl
4
5 set maxnodes 3
6 set lanstr ""
7
8 for {set i 1} {$i <= $maxnodes} {incr i} {
9     set node($i) [$ns node]
10     append lanstr "$node($i) "
11     tb-set-node-os $node($i) FBSD-STD
12 }
13
14 # Put all the nodes in a lan
15 set big-lan [$ns make-lan "$lanstr" 100Mb 0ms]
16
17 # Go!
18 $ns run