Hello.

I was wondering if there is a way to access the return value of a TCL
command scheduled with "$ns at ..." (where $ns is the instance of the
simulator). Maybe an example will clarify what I mean:

Let's say I want to setup and cancel some time slot reservation. I have
two commands on a node "setup" with a bunch of parameters, returning the
id of a reservation and cancel expecting the id of a reservation. What I
wanted to do in my script is something like this...

$ns at 2.0 "$node setup ..." -> we need to access the return value here
$ns at 4.0 "$node cancel $id"

I tried
$ns at 2.0 "set id [$node setup ...]"
and also
set id [$ns at 2.0 "$node setup ..."]


The first one gives an error that (when using cancel) the $id variable is
not defined and the second stores a value in the id but it's not the id
assigned (returned) by the method.

I was wondering if it is possible at all to access the value because as
far as I understood, the at command only schedules the events (and they
get evaluated later). Hence, when scheduling the "cancel" event the setup
command hasn't been run yet and therefore the assigend id is unknown. But
maybe I'm missing something here. Any ideas? Thanks for your help.

Kind regards,
Karsten Roscher



Reply via email to