[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns]: ns-2.1b7: "instvar" call in Redhat Linux




I came across with a very strange problem. I wanted to trace
a variable defined in TCP agent, say ndatapack_, so I wrote 
the following code:

...
set tcp [new Agent/TCP]
...

proc monitor {} {
   global tcp

   $tcp instvar ndatapack_

   puts "ndatapack = $ndatapack_"

   $tcp instvar ndatapack_
   puts "ndatapack = $ndatapack_"
}

$ns at 1.0 "monitor"


I.e., I printed it twice in the same function, however, I 
got two different values for ndatapack_, the first one is
a reasonable value (some positive number), but the
second one is always 0.

So I used tcl-debugger to trace the program, and found
that after "xxx instvar xxxx", ns automatically
add a statement "set xxxx 0". (Magic!)

I don't know why this happens, I'm using Red Hat 6.2, and
installed ns-2.1b7 on it. I ran exactly the same
piece of code on my Sun Solaris station, which has
ns-2.1b6 installed, then the problem disappeared.
Does anyone have the same experience before? I need help
from you, thanks.


Guo, Liang 

[email protected]                     Dept. of Comp. Sci., Boston Univ.,