【发布时间】:2014-07-18 13:51:10
【问题描述】:
我需要帮助来解决这个问题:
Starting Simulation...
ns: start": invalid command name "start""
while executing
"start""
我有一个文件 bash 和一个文件 tcl,但我不知道为什么它总是给我这个问题。
这是文件 cbrgen 中的第二个问题
proc create-cbr-connection { src dst } {
global rng cbr_cnt opt
set stime [$rng uniform 0.0 10.0]
puts "#\n# $src connecting to $dst at time $stime\n#"
##puts "set cbr_($cbr_cnt) \[\$ns_ create-connection \
##CBR \$node_($src) CBR \$node_($dst) 0\]";
puts "set udp_($cbr_cnt) \[new Agent/UDP\]"
puts "\$ns_ attach-agent \$node_($src) \$udp_($cbr_cnt)"
puts "set null_($cbr_cnt) \[new Agent/Null\]"
puts "\$ns_ attach-agent \$node_($dst) \$null_($cbr_cnt)"
puts "set cbr_($cbr_cnt) \[new Application/Traffic/CBR\]"
puts "\$cbr_($cbr_cnt) set packetSize_ $opt(pktsize)"
puts "\$cbr_($cbr_cnt) set interval_ $opt(interval)"
puts "\$cbr_($cbr_cnt) set random_ 1"
puts "\$cbr_($cbr_cnt) set maxpkts_ 10000"
puts "\$cbr_($cbr_cnt) attach-agent \$udp_($cbr_cnt)"
puts "\$ns_ connect \$udp_($cbr_cnt) \$null_($cbr_cnt)"
set start [expr {10*rand()}]
puts "\$ns_ at $start \"\$cbr_($cbr_cnt) start\""
puts "\$ns_ at 100 \"\$cbr_($cbr_cnt) stop\""
【问题讨论】:
-
您的代码示例太长了。将其缩小到您认为可能导致问题的部分。
-
我认为这是部分:set start [expr {10*rand()}] puts "\$ns_ at $start\"\$cbr_($cbr_cnt) start\"" puts " \$ns_ 在 100\"\$cbr_($cbr_cnt) 停止\""