Hi,
I was trying to assign and use state variables inside a FullTcp agent like
is done using normal TCP agents. For ex, I create and use a session_number
state variable below:

set tcpagent [new Agent/TCP/FullTcp]
$tcpagent set session_number 0

When I overload the done{} method for the FullTcp agent, I am not able to
access any state variables which I created. ie, when I try

Agent/TCP/FullTcp instproc done { } {
   puts [$self set session_number]
}

I get an error

----------------------------
ns: _o89 done: can't read "session_number": no such variable
    while executing
"subst $[subst $var]"
    (procedure "_o89" line 5)
    (Object next line 5)
    invoked from within
"_o89 next session_number"
    ("eval" body line 1)
    invoked from within
"eval $self next $args"
    (procedure "_o89" line 18)
    (Agent set line 18)
    invoked from within
"$agent set session_number"
    (procedure "_o89" line 4)
    (Agent/TCP/FullTcp done line 4)
    invoked from within
"_o89 done"
------------------------------

The wierd thing is, if I create a done method specific to a particular
instance of the FullTcp agent, I am able to use the state variables and I
get no error. ie, the following works fine

set tcpagent [new Agent/TCP/FullTcp]
$tcpagent set session_number 0

$tcpagent proc done { } {
   puts [$self set session_number]
}


I have been digging around the code for the past 3 days but have not found
why it behaves this way for the FullTcp agent alone (because it behaves just
fine for a normal TCP agent). And yes, I did search the archives to the best
of my knowledge and I couldn't find any information related to this.

Any help would be greatly appreciated!
Thanks,
Sid

Reply via email to