[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] What's wrong with my code?



On Mon, 15 May 2000, Yongmin Choi wrote:

> I'd like make a network configuration, in which 40 nodes are connected to 1
> node (gateway)
> that is connected to a bottleneck link (buffer size = 20), in turn.
> The tcl code for this simulation is as follows.
> 
> # Create N nodes for TCPs
> for {set i 0} {$i < 40} {incr i} {
> set n($i) [$ns node]
> }
> 
> # Create a gateway and a TCP sink
> set n(40) [$ns node]
> set n(41]) [$ns node]

I would be very surprised if the above line parses, but then
Tcl's handling of brackets is counterintuitive (rantrant
# { 
fails rant.). Count the brackets.

I suspect you've created a node named '41]', not '41'...

L.

<[email protected]>PGP<http://www.ee.surrey.ac.uk/Personal/L.Wood/>

> # Create links between the TCP nodes and the gateway
> for {set i 0} {$i < 40} {incr i} {
> $ns duplex-link $n($i) $n(40) 10Mb 1ms DropTail
> }
> 
> # Create link between the gateway and the sink
> $ns duplex-link $n(40) $n(41) 1Mb 15ms Droptail
> ==================================
> # Set up the buffer size of the link
> $ns queue-limit $n(40) $n(41) 20
> 
> However, I cannot run the ns simulation
> because of the error in creating link between the node 40 and 41.
> Can anyone show me how to correct the error?
> Thanks in advance,
> 
> Yongmin Choi