Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set ns [new Simulator]
- set nf [open out.nam w]
- $ns namtrace-all $nf
- proc fim {} {
- global ns nf
- $ns flush-trace
- close $nf
- exec nam out.nam
- exit 0
- }
- set n0 [$ns node]
- set n1 [$ns node]
- $ns duplex-link $n0 $n1 20Kb 1.45ms DropTail
- #Cria um agente UDP e liga-o ao nó n0
- set udp0 [new Agent/UDP]
- $ns attach-agent $n0 $udp0
- #Cria uma fonte de tráfego CBR e liga-a ao udp0
- set cbr0 [new Application/Traffic/CBR]
- $cbr0 set packetSize_ 1024
- $cbr0 set interval_ 1
- $cbr0 set maxpkts_ 1
- $cbr0 attach-agent $udp0
- #Cria um agente Null e liga-o ao nó n1
- set null0 [new Agent/Null]
- $ns attach-agent $n1 $null0
- $ns connect $udp0 $null0
- $ns at 0.1 "$cbr0 start"
- $ns at 0.6 "$cbr0 stop"
- $ns at 5.0 "fim"
- $ns run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement