You're using NS2, so that means you're using the object system OTcl (which is built on top of standard Tcl). To install an override of the send
method so that you can apply the delay, you need to use slightly different syntax. This all assumes that Agent/TCP
is a subclass of a class that defines send
…
Agent/TCP instproc send {size} {
# Change the delay
$self change_del
# Chain to the superclass implementation
$self next $size
}
The next
method is rather magical in OTcl; it looks up the caller's superclass implementation and calls that with the arguments provided to it. It's similar (but not identical to) the super
keyword in Java and the base
keyword in C#.
If Agent/TCP
is an instance, you use this instead:
Agent/TCP proc send {size} {
# Change the delay
$self change_del
# Chain to the superclass implementation
$self next $size
}
That looks almost identical, except now we're using proc
instead of instproc
.