[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange error
Ah, I found why: The "i" in the loop should be "$i".
Sorry for the bother. :)
Frank
--- Frank Chu <[email protected]> wrote:
> This code generated an error:
> can't read "ftp(1)": no such element in array
> while executing
> "$ns at 1.0 "$ftp($i) start""
>
> The code is: (Note: MAX_TCP_PAIRS is 10)
>
> for {set i 1} {$i<=$MAX_TCP_PAIRS} {incr i 1} {
> set tcpsource(i) [new Agent/TCP/Reno]
> $ns attach-agent $tcpsourcenode(i) $tcpsource(i)
> set tcpsink(i) [new Agent/TCPSink]
> $ns attach-agent $tcpsinknode(i) $tcpsink(i)
> $ns connect $tcpsource(i) $tcpsink(i)
> set ftp(i) [new Application/FTP]
> $ftp(i) attach-agent $tcpsource(i)
> $ns at 1.0 "$ftp($i) start" <-------- error
> appears
> $ns at 61.0 "$ftp($i) stop"
> }
>
> very strange error ?
>
> Frank
> __________________________________________________
> Do You Yahoo!?
> Bid and sell for free at http://auctions.yahoo.com
>
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com