[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] Question about addr_ in Agent!
Hello,
I have a question about "addr_" in Agent!
I am trying to develop a new agent that is of course a child class of
Agent. In my code, I would like to use "addr_". However, to my
surprise, in my TCL file, the addr_ is always 1024. Definitely, it is
not right. At the same time, in my C++ code, it is always 0.
I do not know why.
I have tried to trace in the TCL instproc "attach" in
ns-node.tcl. Even after the command
"$agent set addr_ [expr (($port & $mask) << $shift) | ( ~($mask <<
$shift) & $nodeaddr)]"
The addr_ is still 1024, nodeaddr is 1024.
Only address_ of Node looks right.
However, I traced another type of successful agent. It looks have
the same situation above.
In addition, I find, in my tcl file, I try to test the proc
"Node instproc getid".
I just "set n0 [ new Node]"
then try "set node_id [ $n0 getid ]".
But it does not work and report some error information.
I really do not know what is the reason for the above problems. Is
there any suggestion for me?
Anyway, thanks in advance!
By the way, my ns is "ns-allinone-2.1b5".
Sun Kai