Advertisement
Guest User

Untitled

a guest
Oct 20th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. set ns [new Simulator]
  2. set nf [open out.nam w]
  3. $ns namtrace-all $nf
  4. proc fim {} {
  5. global ns nf
  6. $ns flush-trace
  7. close $nf
  8. exec nam out.nam
  9. exit 0
  10. }
  11. set n0 [$ns node]
  12. set n1 [$ns node]
  13. $ns duplex-link $n0 $n1 20Kb 1.45ms DropTail
  14. #Cria um agente UDP e liga-o ao nó n0
  15. set udp0 [new Agent/UDP]
  16. $ns attach-agent $n0 $udp0
  17. #Cria uma fonte de tráfego CBR e liga-a ao udp0
  18. set cbr0 [new Application/Traffic/CBR]
  19. $cbr0 set packetSize_ 1024
  20. $cbr0 set interval_ 1
  21. $cbr0 set maxpkts_ 1
  22. $cbr0 attach-agent $udp0
  23. #Cria um agente Null e liga-o ao nó n1
  24. set null0 [new Agent/Null]
  25. $ns attach-agent $n1 $null0
  26. $ns connect $udp0 $null0
  27.  
  28. $ns at 0.1 "$cbr0 start"
  29. $ns at 0.6 "$cbr0 stop"
  30.  
  31. $ns at 5.0 "fim"
  32. $ns run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement