I have referred to a program of ns2 the program is giving me Segmentation fault(Core Dumped) when i changed this -> $ns at 0.5 “$cbr0 start” to this->$ns at 0.5 "$cbr0 start". Are the "" any problem .If i change "" to “” following is the error
ERRORS
(_o5 cmd line 1) invoked from within "_o5 cmd at 0.5 “_o84 start”" invoked from within "catch "$self cmd $args" ret" invoked from within "if [catch "$self cmd $args" ret] { set cls [$self info class] global errorInfo set savedInfo $errorInfo error "error when calling class $cls: $args" $..." (procedure "_o5" line 2) (SplitObject unknown line 2) invoked from within "_o5 at 0.5 “o84 start”" ("eval" body line 1) invoked from within "eval $scheduler at $args" (procedure "_o3" line 3) (Simulator at line 3) invoked from within "$ns at 0.5 “$cbr0 start”" (file "b.tcl" line 71)
CODE:
set ns [new Simulator]
#Define different colors for data flow
$ns color 1 Blue
$ns color 2 Red
#open the nam trace file
set nf [open out.nam w]
$ns namtrace-all $nf
#define a finish procedure
proc finish {} {
global ns nf
$ns flush-trace
#close the trace file
close $nf
#execute nam on the trace file
exec nam out.nam&
exit 0
}
#create four nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
#create links between nodes
$ns duplex-link $n0 $n2 1Mb 10ms DropTail
$ns duplex-link $n1 $n2 1Mb 10ms DropTail
$ns duplex-link $n3 $n2 1Mb 10ms SFQ
#orientation
$ns duplex-link-op $n0 $n2 orient right-down
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n2 $n3 orient right
#Monitors the queue for the link betweeen node 2 & 3
$ns duplex-link-op $n2 $n3 queuePos 0.5
#Create udp agent and attatch it to node 0
set udp0 [new Agent/UDP]
$udp0 set class_ 1
$ns attach-agent $n0 $udp0
#Create CBR traffic source & attatch it to upd0
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005
$cbr0 attach-agent $udp0
#Create udp agent and attatch it to node 1
set udp1 [new Agent/UDP]
$udp1 set class_ 2
$ns attach-agent $n1 $udp1
#Create CBR traffic source & attatch it to upd1
set cbr1 [new Application/Traffic/CBR]
$cbr1 set packetSize_ 500
$cbr1 set interval_ 0.005
$cbr0 attach-agent $udp1
#Create a CBR traffic source & attatch it to udp 1
set null0 [new Agent/Null]
$ns attach-agent $n3 $null0
#connect the traffic source with the traffic sink
$ns connect $udp0 $null0
$ns connect $udp1 $null0
#Schedule events for the CBR agent
$ns at 0.5 “$cbr0 start”
$ns at 1.0 “$cbr1 start”
$ns at 4.0 “$cbr1 stop”
$ns at 4.5 “$cbr0 stop”
#call finish after 5 seconds of simulation time
$ns at 5.0 “finish”
#Run the simulator
$ns run