Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. #Start NS and DV Agent
  2. set ns [new Simulator]
  3. $ns rtproto DV
  4.  
  5. #Trace File Creation
  6. set nf [open tcp_Tahoe_out_drop7.nam w]
  7. $ns namtrace-all $nf
  8. set f [open tcp_Tahoe_out_drop7.tr w]
  9. $ns trace-all $f
  10.  
  11. #Node Creation
  12. set S1 [$ns node]
  13. set R1 [$ns node]
  14. $ns duplex-link $S1 $R1 1Mb 10ms DropTail
  15.  
  16. #Transport Connection Creation set to Tahoe
  17. set tcptahoe [new Agent/TCP]
  18. $ns attach-agent $S1 $tcptahoe
  19. set tcpsink [new Agent/TCPSink]
  20. $ns attach-agent $R1 $tcpsink
  21. $ns connect $tcptahoe $tcpsink
  22.  
  23. #CWND Trace File Creation
  24. set cwndf [open tcp_Tahoe_cwnd_drop7.tr w]
  25. $tcptahoe attach $cwndf
  26. $tcptahoe trace cwnd_
  27.  
  28. #FTP Application Creation
  29. set ftp [new Application/FTP]
  30. $ftp attach-agent $tcptahoe
  31.  
  32. #Error Generation Drop 7 13 14
  33. set loss_module [new ErrorModel/List]
  34. $loss_module droplist 7
  35. $ns lossmodel $loss_module $S1 $R1
  36.  
  37. #Run Simulation and End Trace File
  38. $ns at 0.5 "$ftp start"
  39. $ns at 3.0 "finish"
  40. proc finish {} {
  41. global ns nf
  42. $ns flush-trace
  43. close $nf
  44. puts "running nam..."
  45. exit 0
  46. }
  47. $ns run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement