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

[ns] Problem with hierarchical addressing with TCP



I am new to NS and i am trying to build a simple topology with hierarchical addressing with TCP Traffic when i run the script It gives me an illegal operation error on 98
but when i work the same script with flat addressing the script runs perfectly
 
can anyone help me out  with this problem
I am attaching the script so if there is any problem with it please tell me
 
 

set ns [new Simulator]

$ns rtproto Session

$ns set-address-format hierarchical

 

set f [open out.tr w]

$ns trace-all $f

set nf [open out.nam w]

$ns namtrace-all $nf

 

AddrParams set domain_num_ 1

lappend cluster_num 1

AddrParams set cluster_num_ $cluster_num

lappend eilastlevel 4

AddrParams set nodes_num_ $eilastlevel

 

set num_node 4

 

proc finish {} {

global ns nf

global ns f

$ns flush-trace

close $nf

close $f

exit 0

}

set temp {0.0.0 0.0.2 0.0.11 0.0.6}

 

for {set i 0} {$i < $num_node } {incr i} {

set n($i) [$ns node [lindex $temp $i]]

puts " [$n($i) node-addr]"

puts " [$n($i) id]"

}

 

for {set i 0} {$i < $num_node} {incr i} {

$ns duplex-link $n($i) $n([expr ($i+1)%$num_node]) 1Mb 10ms DropTail

}

$ns duplex-link $n(0) $n(2) 1Mb 10ms DropTail

$ns duplex-link-op $n(0) $n(1) queuePos 0.5

 

 

$ns cost $n(0) $n(1) 2

$ns cost $n(0) $n(3) 5

$ns cost $n(0) $n(2) 4

$ns cost $n(1) $n(2) 1

$ns cost $n(2) $n(3) 1

$ns cost $n(1) $n(0) 2

$ns cost $n(3) $n(0) 5

$ns cost $n(2) $n(0) 4

$ns cost $n(2) $n(1) 1

$ns cost $n(3) $n(2) 2

 

set tcp [new Agent/TCP]

$ns attach-agent $n(0) $tcp

set ftp [new Application/FTP] ;

$ftp attach-agent $tcp

set sink [new Agent/TCPSink]

$ns attach-agent $n(3) $sink

$ns at 0.5 "$ftp start"

$ns connect $tcp $sink

$ns rtmodel-at 1.0 down $n(1) $n(2)

$ns rtmodel-at 2.0 up $n(1) $n(2)

$ns at 5.0 "finish"

 

$ns run