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 Nesher <vessely...@gmail.com>

> 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>

Reply via email to