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

[ns] Need Help!!!



Hi

I am trying to simulate the following scenario

		  n0
		 /  \
		/    \
	       /      \
	      /	       \
	     n1	        n2


n0 is TCP traffic-source sending some Voice data to both n1 and n2 which are 
recipients. I created n0 as TCP Agent and n1 and n2 as Sinks. I need to use 
Unicast Routing.
How I can create one source and two sinks like in above configuration.
The following code is not working.


#Creating a simulator Object

set ns [new Simulator]

#opening a trace file

set nf [open out.nam w]
$ns namtrace-all $nf

#Defining a 'finish' procedure

proc finish {} {
	global ns nf
	$ns flush-trace
	#Close the trace file
	close $nf
	#Now execute Nam on the trace file
	exec nam out.nam &
	exit 0
}


$ns rtproto DV

set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]

$ns color 1 Blue

$ns duplex-link $n0 $n1 1Mb   10ms SFQ
$ns duplex-link $n0 $n2 500kb 10ms SFQ

#$ns duplex-link-op $n0 $n1 orient left_down
#$ns duplex-link-op $n0 $n2 500kb orient right_down

#Create TCP agent and attaching it to node n0
set tcp0 [new Agent/TCP]
$ns attach-agent $n0 $tcp0

set sink1 [new Agent/TCPSink]
#set sink2 [new Agent/TCPSink]

$ns attach-agent $n1 $sink1
#$ns attach-agnet $n2 $sink2

$ns connect $tcp0 $sink1
#$ns connect $tcp0 $sink2

#using FTP just to generate constant packets
set ftp0 [new Application/FTP]
$ftp0 attach-agent $tcp0

$ns at 0.5 "$ftp0 start"

$ns at 4.5 "$ftp0 stop"

$tcp0 set class_ 1

$ns at 5.0 "finish"


#Run the Simulation
$ns run





Any thoughts?? need help!!!!



Ali


_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.