Skip to content. | Skip to navigation

Personal tools

Navigation

You are here: Home / Wiki / Attachment / Tutorial / Loop.Ns

Loop.Ns

Plain Text icon — Plain Text, 1 KB

File contents

# This is a simple ns script that demonstrates loops.
set ns [new Simulator]                  
source tb_compat.tcl

set maxnodes 3
set lanstr ""

for {set i 1} {$i <= $maxnodes} {incr i} {
    set node($i) [$ns node]
    append lanstr "$node($i) "
    tb-set-node-os $node($i) FBSD-STD
}

# Put all the nodes in a lan
set big-lan [$ns make-lan "$lanstr" 100Mb 0ms]

# Go!
$ns run