NS-2 (Network Simulator) error getting TCP window: "error when calling class $cls: $args" $..."

StackOverflow https://stackoverflow.com/questions/20059170

  •  31-07-2022
  •  | 
  •  

Question

I'm trying to follow a Network Simulator tutorial using NS-2 version 2.35 on Ubuntu, but I can't seem to see the TCP window size and the error I get seems useless. The code:

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

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

The output:

    (_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)

How do I fix this problem and output the TCP window size? More generally, is there a way to get more useful errors?

Was it helpful?

Solution

According to this tutorial, you use the set method to both write and read from instance variables, depending on how many arguments you give it. This is just like the base Tcl set command (though that doesn't really know about instance variables). Thus, in your case you might do:

puts [$tcp set window_]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top