Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #declaration d'un nv object
- set ns [new Simulator]
- #decl aration des fichiers qui vont contenir le rsx
- set ftrace [open trace1.tr w]
- set nf [open tp1.nam w]
- $ns namtrace-all $nf
- #la topologie de rsx, 2 noeuds et 1 lien ful_duplex
- set n0 [$ns node]
- set n1 [$ns node]
- $ns duplex-link $n0 $n1 1Mb 10ms DropTail
- #Niveau transport : Agent UDP et Null
- set udp [new Agent/UDP]
- set null [new Agent/Null]
- $ns attach-agent $n0 $udp
- $ns attach-agent $n1 $null
- $ns connect $udp $null
- #creation de la source de trafic : CBR
- set cbr [new Application/Traffic/CBR]
- $cbr set packetSize_ 500
- $cbr set interval_ 0.005
- $cbr attach-agent $udp
- #procedure qui termine la simulation
- proc finish {} {
- global ns nf ftrace
- $ns flush-trace
- close $nf
- exec nam tp1.nam &
- exit 0
- }
- #faire partir la source CBR et lancer la simution
- $ns at 0.5 "$cbr start"
- $ns at 4.5 "$cbr stop"
- $ns at 5.0 "finish"
- $ns run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement