获取TCP窗口的NS-2(网络模拟器)错误:“调用类$ cls时出错:$ args”$ ...“

时间:2013-11-18 22:21:09

标签: tcl ns2

我正在尝试在Ubuntu上使用NS-2版本2.35的网络模拟器教程,但我似乎无法看到TCP窗口大小和我得到的错误似乎无用。代码:

set ns [new Simulator]
set tcp [new Agent/TCP]
$tcp set window_ 1

# This fails!
puts [$tcp window]
# So does this:
#puts [$tcp window_]

输出:

    (_o10 cmd line 1)
    invoked from within
"_o10 cmd window"
    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 "_o10" line 2)
    (SplitObject unknown line 2)
    invoked from within
"$tcp window"
    invoked from within
"puts [$tcp window]"
    (file "window-test.tcl" line 8)

如何解决此问题并输出TCP窗口大小?更一般地说,有没有办法获得更多有用的错误?

1 个答案:

答案 0 :(得分:1)

根据this tutorial,您使用set方法 从实例变量中读取,具体取决于您提供的参数数量它。这就像基本的Tcl set命令(虽然它并不真正了解实例变量)。因此,在您的情况下,您可能会这样做:

puts [$tcp set window_]