Hi everybody, I experienced a very odd problem. I want to output the number of bytes received by a TCPSink agent at a specified time. This can be read by the instance variable $bytes_. Now if I call a procedure at the required point of time, which outputs the nr of bytes, everything works fine. Like this:
... proc testproc {} { global tcp1 puts stdout "Rx bytes (within testproc): [$tcp1 set bytes_]" } ... $ns at 1.0 testproc ... But if I want to output this value directly (without a wrapping procedure, the output is always 0! Like that: $ns at 1.0 "puts stdout \"Rx bytes (directly): [$tcp1 set bytes_]\"" How can that be? I use ns-2.31. The complete code of a minimal example to reproduce the problem is here: ######################### Example ############################# set ns [new Simulator] proc testproc {} { global tcp1 puts stdout "Rx bytes (within testproc): [$tcp1 set bytes_]" } set n0 [$ns node] set n1 [$ns node] $ns duplex-link $n0 $n1 1mb 50ms DropTail set tcp0 [new Agent/TCP] set tcp1 [new Agent/TCPSink] $ns attach-agent $n0 $tcp0 $ns attach-agent $n1 $tcp1 $ns connect $tcp0 $tcp1 set ftp0 [new Application/FTP] $ftp0 attach-agent $tcp0 $ns at 0.1 "$ftp0 start" $ns at 1.0 testproc $ns at 1.0 "puts stdout \"Rx bytes (directly): [$tcp1 set bytes_]\"" $ns at 1.5 "$ftp0 stop" $ns at 1.6 "exit 0" $ns run ######################## /Example ############################# Output: % ns min_ex.tcl Received bytes (within testproc): 66600 Received bytes (directly): 0 Thanks for any hint! Georg