Advertisement
Guest User

Untitled

a guest
Apr 7th, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. set ns [new Simulator]
  2.  
  3. set nf [open out.nam w]
  4. $ns namtrace-all $nf
  5.  
  6. set mytrace [open out.tr w]
  7. $ns trace-all $mytrace
  8.  
  9. proc finish {} {
  10. global ns nf mytrace
  11. $ns flush-trace
  12.  
  13. close $nf
  14. close $mytrace
  15. exec nam out.nam &
  16.  
  17. exit 0
  18. }
  19.  
  20. set n0 [$ns node]
  21. set n1 [$ns node]
  22.  
  23. $ns duplex-link $n0 $n1 1Mb 10ms DropTail
  24.  
  25. set udp0 [new Agent/UDP]
  26. $ns attach-agent $n0 $udp0
  27.  
  28. set cbr0 [new Application/Traffic/CBR]
  29. #$cbr0 set packetSize_ 500
  30. #$cbr0 set interval_ 0.1
  31. $cbr0 attach-agent $udp0
  32.  
  33. set null0 [new Agent/Null]
  34. $ns attach-agent $n1 $null0
  35.  
  36. $ns connect $udp0 $null0
  37.  
  38. $ns at 0.0 "$cbr0 start"
  39. $ns at 4.9 "$cbr0 stop"
  40.  
  41. $ns at 5.0 "finish"
  42. $ns run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement