CS158a
Chris Pollett
Feb. 23, 2011
./installIf you have much win this will work. For the rest of us, you will probably need to search around to find tweaks to this script to get it compile everything. For example, on a Mac, I installed the developer tools and X11 from my OSX disc. Then I search around for how to modify the install script, found http://old.nabble.com/Installation-on-OSX-10.6-td27790838.html, compiled it and it worked.
ns script-to-use.tcl
set ns [new Simulator] set nf [open out.nam w] $ns namtrace-all $nf proc finish {} { global ns nf $ns flush-trace close $nf exec nam out.nam & exit 0 } #your code here... #means comment rest of line $ns at 5.0 "finish" $ns run
set ns [new Simulator] set nf [open out.nam w] $ns namtrace-all $nf proc finish {} { global ns nf $ns flush-trace close $nf exec nam out.nam & exit 0 } set n0 [$ns node] #set up a node set n1 [$ns node] #set up another node $ns duplex-link $n0 $n1 1Mb 10ms DropTail #says the kind of connection between them #Create a UDP agent and attach it to node n0 set udp0 [new Agent/UDP] $ns attach-agent $n0 $udp0 # Create a CBR (constant bit rate) # traffic source and attach it to udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 set packetSize_ 500 $cbr0 set interval_ 0.005 $cbr0 attach-agent $udp0 #Create a Null agent (a traffic sink) and attach it to node n1 set null0 [new Agent/Null] $ns attach-agent $n1 $null0 #Connect the traffic source with the traffic sink $ns connect $udp0 $null0 #Schedule events for the CBR agent $ns at 0.5 "$cbr0 start" $ns at 4.5 "$cbr0 stop" #Call the finish procedure after 5 seconds of simulation time $ns at 5.0 "finish" $ns run