Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Start NS and DV Agent
- set ns [new Simulator]
- $ns rtproto DV
- #Trace File Creation
- set nf [open tcp_Tahoe_out_drop7.nam w]
- $ns namtrace-all $nf
- set f [open tcp_Tahoe_out_drop7.tr w]
- $ns trace-all $f
- #Node Creation
- set S1 [$ns node]
- set R1 [$ns node]
- $ns duplex-link $S1 $R1 1Mb 10ms DropTail
- #Transport Connection Creation set to Tahoe
- set tcptahoe [new Agent/TCP]
- $ns attach-agent $S1 $tcptahoe
- set tcpsink [new Agent/TCPSink]
- $ns attach-agent $R1 $tcpsink
- $ns connect $tcptahoe $tcpsink
- #CWND Trace File Creation
- set cwndf [open tcp_Tahoe_cwnd_drop7.tr w]
- $tcptahoe attach $cwndf
- $tcptahoe trace cwnd_
- #FTP Application Creation
- set ftp [new Application/FTP]
- $ftp attach-agent $tcptahoe
- #Error Generation Drop 7 13 14
- set loss_module [new ErrorModel/List]
- $loss_module droplist 7
- $ns lossmodel $loss_module $S1 $R1
- #Run Simulation and End Trace File
- $ns at 0.5 "$ftp start"
- $ns at 3.0 "finish"
- proc finish {} {
- global ns nf
- $ns flush-trace
- close $nf
- puts "running nam..."
- exit 0
- }
- $ns run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement