# a very simple tcp simulation to start with # run the simulation and view in nam. # Now change the queue size of r1 and r2 to 10. (Uncomment the 2 lines.) # Do you see pkt drops in nam? # Now change the window size of the tcp connection to 10. Do you see drops? # # Create a simple four node topology: # # s1 s2 # \ / # 10Mb,2ms \ 1.5Mb,20ms / 10Mb,4ms # r1 --------- r2 set ns [new Simulator] #set f [open simple.tr w] #$ns trace-all $f set nf [open simple.nam w] $ns namtrace-all $nf set node_(s1) [$ns node] set node_(s2) [$ns node] set node_(r1) [$ns node] set node_(r2) [$ns node] $ns duplex-link $node_(s1) $node_(r1) 10Mb 2ms DropTail $ns duplex-link $node_(s2) $node_(r2) 10Mb 4ms DropTail $ns duplex-link $node_(r1) $node_(r2) 1.5Mb 10ms RED #$ns queue-limit $node_(r1) $node_(r2) 10 #$ns queue-limit $node_(r2) $node_(r1) 10 $ns duplex-link-op $node_(s1) $node_(r1) orient right-down $ns duplex-link-op $node_(s2) $node_(r2) orient right-up $ns duplex-link-op $node_(r1) $node_(r2) orient right $ns duplex-link-op $node_(r1) $node_(r2) queuePos 0 $ns duplex-link-op $node_(r2) $node_(r1) queuePos 0 set tcp [new Agent/TCP/Reno] set sink [new Agent/TCPSink] #$tcp set window_ 10 $ns attach-agent $node_(s1) $tcp $ns attach-agent $node_(s2) $sink $ns connect $tcp $sink set ftp [new Application/FTP] $ftp attach-agent $tcp $ns at 0.1 "$ftp start" $ns at 5 "finish" proc finish {} { global ns f nf $ns flush-trace # close $f close $nf puts "running nam..." exec nam simple.nam & exit 0 } $ns run