Hello, first of all read my previous mail.
I just want to change it's end :
the topology needs to look like this
n1---| |---n4
n2---|- - r1- -|---n5
n3---| |---n6
n1,n2,n3 tcp/udp agents
n4,n5,n6 sink/null agents
r1 I create separately
thanks.
-- Forwarded message --
Hi,Thanks.
first, The error that I got:
~/ns-allinone-2.34/ns-2.34/v1$ ns script.tcl
can't read n: no such variable
while executing
$ns duplex-line $n$i $ns[expr $i+1] 5Mb 2ms Drop Tail
(for body line 6)
invoked from within
for {set i 0} {$i $numofnodes} {incr i} {
set n$i [$ns node]
if {$i == [expr $numofnodes - 1]} {
$ns duplex-line $n[expr $i - 1] $ns...
(file script1.tcl line 49)
More questions..
1. Why duplex-line instead of duplex-link?
2. What is $ns[expr $i+1]. why not $n[expr $i+1]?
3. How the next node (i+1) can be known if I will create it just in the next
loop?
by the way, my topology needs to look like this:
n1---|
n2---|
n3---|-r1
n4---|
n5---|
r1: I create separately.
Thank you!
On Thu, May 19, 2011 at 12:22 AM, мαłłi malli@gmail.com wrote:
Tami,
For your question my answer is
1. yes u got it, i forget to put s instead i put number thanks
2. yes we can do
The topology
n1 --- n2 --- n3 --- n4 --- n5
set requiredNodes 5
for {set i 0} {$i $requiredNodes} {incr i} {
set n$i [$ns node]
if {$i == [expr $requiredNodex - 1]} {
$ns duplex-line $n[expr $i - 1] $ns$i 5Mb 2ms Drop Tail
} else {
$ns duplex-line $n$i $ns[expr $i+1] 5Mb 2ms Drop Tail
set tcp [new Agent/TCP]
$tcp set class_ 1
$ns attach-agent $n$i $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $n[expr $i+1] $sink
}
}
I didn't test the script, i generally wrote this one, please test it and
let me know status of this,
if you want specify specific bandwidth between the nodes, you manually
stored in a list
suppose *set bandwidth [ 2Mb, 3Mb, 4Mb, 5Mb, 0.2Mb] by using list index*we
can get the bandwidth
similarly what ever you need (specifically) that stored in a list and use
them
2011/5/17 Tami
Thank you for all answers.
1. Did you mean to write like this?(with s)
set s 10
for {set i 0} {$i *$s*} {incr i} {
set n$i [$ns node]
2. I want also to create* links* between the nodes, to *attach
agents(tcp or udp)* and *start them*.
I need to do everey thing in the same way, with for ?
ex.
for {set j 0} {$j $s/2} {incr j} {
$ns duplex-link n$j n$s/2+$j 2Mb 10ms DropTail
# Is it right to write like this?? and what can I do if I want to change
the bandwidth sometimes?
*Thank you!
*
On Tue, May 17, 2011 at 2:33 PM, мαłłi malli@gmail.com wrote:
Tami,
What I understand you question is you have an variable, based on that you
need to create that much of users?
Ex. set s 10
for {set i 0} {$i 10} {incr i} {
set n$i [$ns node]
}
On 17 May 2011 15:43, Tami Nesher vessely...@gmail.com wrote:
Hi,
How can I create nodes according to a variable number?
I mean : I have a variable that contains the number of nodes that I need
to
create. How can I do it?
--
Thanks,
The box said Requires Windows 95, NT, or better, so I installed Linux.
Mallikarjun [:)]
[image: YouTube] http://in.youtube.com/mallikv [image:
Blogger]http://basicnetworktipsntricks.blogspot.com/ [image:
LinkedIn] http://www.linkedin.com/in/mallikarjunaraok
--
Thanks,
The box said Requires Windows 95, NT, or better, so I installed Linux.
Malli [:)]
[image: YouTube] http://in.youtube.com/mallikv [image:
Blogger]http://basicnetworktipsntricks.blogspot.com/ [image:
LinkedIn] http://www.linkedin.com/in/mallikarjunaraok