[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
About the TcpApp& CBQ.
Hi,
I met another qestion: that is when I setup the link to CBQ, it
doesn't work, pls see the error data and the script file...If you know that,
pls give me a hand. Best wishes,
---------------------error data:
ns tcpapp.tcl
ns: _o15 unknown-flow 256 0 1 1:
(_o15 cmd line 1)
invoked from within
"_o15 cmd unknown-flow 256 0 1 1"
invoked from within
"catch "$self cmd $args" ret"
(procedure "_o15" line 2)
(SplitObject unknown line 2)
invoked from within
"_o15 unknown-flow 256 0 1 1"
---------------------------------
Prog:
#Create a simulator object
set ns [new Simulator]
#Open a trace file
set nf [open out.nam w]
$ns namtrace-all $nf
#Define a 'finish' procedure
proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam out.nam &
exit 0
}
#Create three nodes
set n2 [$ns node]
set n1 [$ns node]
#Define different colors for data flows
$ns color 1 Blue
$ns color 2 Red
######################
# Link definition
######################
$ns duplex-link $n1 $n2 10Mb 2ms CBQ
# Set up TCP connection
# set tcp1 [$ns_ create-connection TCP $n1 TCPSink $n2 0]
# $tcp1 set window_ 30
set tcp1 [new Agent/TCP/FullTcp]
set tcp2 [new Agent/TCP/FullTcp]
$ns attach-agent $n1 $tcp1
$ns attach-agent $n2 $tcp2
$ns connect $tcp1 $tcp2
$tcp2 listen
$tcp1 set fid_ 1
$tcp2 set fid_ 2
Application/TcpApp instproc app-recv {size} {
global ns
puts "[$ns now] app2 receives data $size from app1"
}
set app1 [new Application/TcpApp $tcp1]
set app2 [new Application/TcpApp $tcp2]
$app1 connect $app2
####################
# queue class creation
####################
set qlim 20
set cbq_qtype_ DropTail
set topclass_ [new CBQClass]
$topclass_ setparams none 0 1.0 auto 8 2 0
### audio class
set audioclass_ [new CBQClass]
set q1 [new Queue/$cbq_qtype_]
$q1 set limit_ $qlim
$audioclass_ install-queue $q1
$audioclass_ setparams $topclass_ true 0.1 auto 1 1 0
### data class
set dataclass_ [new CBQClass]
set q2 [new Queue/$cbq_qtype_]
$q2 set limit_ $qlim
$dataclass_ install-queue $q2
$dataclass_ setparams $topclass_ true 0.9 auto 2 1 0
####
set cbqlink [$ns link $n2 $n1]
$cbqlink insert $topclass_
$cbqlink insert $audioclass_
$cbqlink insert $dataclass_
$cbqlink bind $audioclass_ 1
$cbqlink bind $dataclass_ 2
$ns at 1.0 "$app1 send 100 \"$app2 app-recv 100\""
$ns at 1.2 "$app2 send 20 \"$app1 app-recv 20\""
$ns at 1.5 "finish"
#Run the simulation
$ns run