My program is showing this error:
warning: no class variable LanRouter::debug_
see tcl-object.tcl in tclcl for info about this warning.
--- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
_o12: no target for slot -1
_o12 type: Classifier/Hash/Dest
content dump:
classifier _o12
0 offset
0 shift
1073741823 mask
1 slots
slot 0: _o139 (Classifier/Port)
-1 default
I have given 2 hours to write this program please help me to get the solution, My Program is given below:
set ns [new Simulator]
$ns color 1 Blue
$ns color 2 Red
set tracefile1 [open out.tr w]
set winfile [open winfile w]
$ns trace-all $tracefile1
set namfile [open out.nam w]
$ns namtrace-all $namfile
proc finish {} {
global ns tracefile1 namfile
$ns flush-trace
close $tracefile1
close $namfile
exec nam out.nam &
exit 0
}
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]
$n1 color Red
$n1 shape box
$ns duplex-link $n0 $n2 2Mb 10ms DropTail
$ns duplex-link $n1 $n2 2Mb 10ms DropTail
$ns simplex-link $n2 $n3 0.3Mb 100ms DropTail
$ns simplex-link $n3 $n2 0.3Mb 100ms DropTail
set lan [$ns newLan "$n3 $n4 $n5" 0.5Mb 40ms LL Queue/DropTail MAC/Csma/Cd Channel]
$ns duplex-link-op $n0 $n2 orient right-down
$ns duplex-link-op $n1 $n2 orient right-up
$ns simplex-link-op $n2 $n3 orient right
$ns simplex-link-op $n3 $n2 orient left
$ns queue-limit $n2 $n3 20
set tcp [new Agent/TCP/Newreno]
$ns attach-agent $n0 $tcp
set sink [new Agent/TCPSink/DelAck]
$ns attach-agent $n4 $sink
$tcp set fid_ 1
$tcp set packet_size_ 552
set ftp [new Application/FTP]
$ftp attach-agent $tcp
set udp [new Agent/UDP]
$ns attach-agent $n1 $udp
set null [new Agent/Null]
$ns attach-agent $n5 $null
$ns connect $udp $null
$udp set fid_ 2
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp
$cbr set type_ CBR
$cbr set packet_size_ 1000
$cbr set rate_ 0.01Mb
$cbr set random_ false
$ns at 0.1 "$cbr start"
$ns at 1.0 "$ftp start"
$ns at 124.0 "$ftp stop"
$ns at 125.0 "$cbr stop"
proc plotWindow {tcpSource file} {
global ns
set time 0.1
set now [$ns now]
set cwnd [$tcpSource set cwnd_]
puts $file "$now $cwnd"
$ns at [expr $now + $time] "plotWindow $tcpSource $file"
}
$ns at 0.1 "plotWindow $tcp $winfile"
$ns at 125.0 "finish"
$ns run
I have tried everything that could have solved the problem, so at last i have to come here to get the solution, So if anyone having solution, please! help me. Thank u!
--- Classfier::no-slot{} default handler
Your file is close to be a copy of https://github.com/dnlove/ammac-ns2/blob/master/duy/tcl/csma.tcl : This original "ammac Csma.Cd file" runs OK.
Your file : A line is missing in section "TCP connection" : $ns connect $tcp $sink
set tcp [new Agent/TCP/Newreno]
$ns attach-agent $n0 $tcp
set sink [new Agent/TCPSink/DelAck]
$ns attach-agent $n4 $sink
$ns connect $tcp $sink ;# added .........
$tcp set fid_ 1
$tcp set packet_size_ 552
.... Then your file runs OK.
If you want to avoid the warning: no class variable LanRouter::debug_
then please add this to the empty line 2 : LanRouter set debug_ 0
( A warning is not an error, is just a text message.)