[ns] Error in Tcl script

Leo Sánchez sancale at ugr.es
Wed Jun 22 10:57:12 PDT 2011


Try defining the process this way:

proc discover_ferry { src dst now index } {
global ns_ node_

...
...
...
}

Hope it helps!

Leo Sánchez



El 22/06/2011 16:48, Mohamed Ibrahim Salman escribió:
> Hi,
>
> This error appear when I try to invoke discover_ferry{} function
>
>
>
> ns: discover_ferry   1 13 0.000000 30000 : can't read "node_(1)": no such variable
>      while executing
> "$ns_ attach-agent $node_($src) $udp_($index)"
>      (procedure "discover_ferry" line 6)
>      invoked from within
> "discover_ferry   1 13 0.000000 30000"
>
>
>
>
>
>
> proc discover_ferry { src dst now index } {
> global ns_ node_($src) node_($dst)
>
> set udp_($index) [new Agent/UDP]
> $ns_ attach-agent $node_($src) $udp_($index)
> set null_($index) [new Agent/Null]
> $ns_ attach-agent $node_($dst) $null_($index)
> set cbr_($index) [new Application/Traffic/CBR]
> $cbr_($index) set packetSize_ 256
>
>
> $cbr_($index) set maxpkts_ 1
> $cbr_($index) attach-agent $udp_($index)
> $ns_ connect $udp_($index) $null_($index)
>
> $ns_ at $now "$cbr_($index) start"
>
> }



More information about the Ns-users mailing list