Simulation 3
Simulation 3
Implement an Ethernet LAN using n nodes and set multiple traffic nodes and plot
congestion window foe different source/destination.
# Create a new simulator instance
set ns [new Simulator]
# Finish Procedure
proc Finish {} {
# Dump all trace data and close the files
global ns ntrace namfile
$ns flush-trace
close $ntrace
close $namfile
# Create 6 nodes
for {set i 0} {$i < 6} {incr i} {
set n($i) [$ns node]
}
# Setup queue between n(2) and n(3) and monitor the queue
$ns queue-limit $n(2) $n(3) 20
$ns duplex-link-op $n(2) $n(3) queuePos 0.5
# Schedule Events
$ns at 0.1 "$ftp0 start"
$ns at 0.1 "PlotWindow $tcp0 $winFile0"
$ns at 0.5 "$ftp1 start"
$ns at 0.5 "PlotWindow $tcp1 $winFile1"
$ns at 25.0 "$ftp0 stop"
$ns at 25.1 "$ftp1 stop"
$ns at 25.2 "Finish"