[ns] Error in Tcl script

Mohamed Ibrahim Salman mohammad_w2000 at yahoo.com
Wed Jun 22 07:48:13 PDT 2011


Hi,

This error appear when I try to invoke discover_ferry{} function



ns: discover_ferry   1 13 0.000000 30000 : can't read "node_(1)": no such variable
    while executing
"$ns_ attach-agent $node_($src) $udp_($index)"
    (procedure "discover_ferry" line 6)
    invoked from within
"discover_ferry   1 13 0.000000 30000 "






proc discover_ferry { src dst now index } {
global ns_ node_($src) node_($dst)

set udp_($index) [new Agent/UDP]
$ns_ attach-agent $node_($src) $udp_($index)
set null_($index) [new Agent/Null]
$ns_ attach-agent $node_($dst) $null_($index)
set cbr_($index) [new Application/Traffic/CBR]
$cbr_($index) set packetSize_ 256


$cbr_($index) set maxpkts_ 1
$cbr_($index) attach-agent $udp_($index)
$ns_ connect $udp_($index) $null_($index)

$ns_ at $now "$cbr_($index) start"

}


More information about the Ns-users mailing list