[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] i'm very new with ns
# TCP connections between node_(0) and node_(2)
set tcp [new Agent/TCP]
$tcp set class_ 2
set sink0 [new Agent/TCPSink]
$ns attach-agent $n0 $tcp
$ns attach-agent $n2 $sink0
$ns connect $tcp $sink0
set ftp [new Application/FTP]
$ftp attach-agent $tcp
Thanks for the reply- as seen above, I did define it
above and I think it's correct. So if it's not the
problem, what are some other possibilities? Thanks so
much in advance!
--- "Marcos \"Locksmith\" Portnoi" <[email protected]>
wrote:
> Hey, it looks like my code!! :))
>
> Check whether sink0 was defined properly outside the
> record procedure, and
> before it. In my code, it is defined as
> set sink0 [new Agent/LossMonitor]
> $ns attach-agent $node $sink0
>
> Portnoi
> ----- Original Message -----
> From: "Raymond Wang" <[email protected]>
> To: <[email protected]>
> Sent: Saturday, 29 de September de 2001 02:26
> Subject: [ns] i'm very new with ns
>
>
> > hi,
> >
> > i'm very new with ns. here is a snippet of my
> code (actually borrowed
> from
> > someone with permission and i'm trying to
> understand it), why does it
> > result in the errors below?
> >
> > thanks a lot!
> > ray
> >
> > proc record {} {
> > global sink0 f0
> > #Get an instance of the simulator
> > set ns [Simulator instance]
> > #Set the time after which the procedure
> should be called again
> > set time 0.5
> > #How many bytes have been received by the
> traffic sinks?
> > set bw0 [$sink0 set bytes_]
> > #Get the current time
> > set now [$ns now]
> > #Calculate the bandwidth (in MBit/s) and
> write it to the files
> > puts $f0 "$now [expr
> $bw0/$time*8/1000000]"
> > #Reset the bytes_ values on the traffic
> sinks
> > $sink0 set bytes_ 0
> > #Re-schedule the procedure
> > $ns at [expr $now+$time] "record"
> > }
> >
> > Errors:
> > ns: record: can't read "bytes_": no such variable
> > while executing
> > "subst $[subst $var"
> > (procedure "_o44" line 5)
> > (Object next line 5)
> > invoked from within
> > "_o44 next bytes_"
> > ("eval" body line 1)
> > invoked from within
> > "eval $self next $args"
> > (procedure "_o44" line 18)
> > (Agent set line 18)
> > invoked from within
> > "$sink0 set bytes_"
> > (procedure "record" line 8)
> > invoked from within
> > "record"
> >
> >
> >
>
__________________________________________________
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com