set ns [new Simulator]
set tracefile [open out.tr w]
$ns trace-all $tracefile
set namfile [open out.nam w]
$ns namtrace-all $namfile
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
$ns duplex-link $n0 $n1 10Mb 10ms DropTail
$ns queue-limit $n0 $n1 5
$ns duplex-link $n1 $n2 0.01Mb 100ms DropTail
$ns queue-limit $n1 $n2 5
set tcp0 [new Agent/TCP]
$ns attach-agent $n0 $tcp0
set sink0 [new Agent/TCPSink]
$ns attach-agent $n2 $sink0
$ns connect $tcp0 $sink0
set ftp0 [new Application/FTP]
$ftp0 attach-agent $tcp0
$ns at 1.0 “$ftp0 start”
$ns at 10.0 “$ftp0 stop”
proc finish {} {
global ns namfile tracefile
$ns flush-trace
close $namfile
close $tracefile
puts “running nam…”
exec nam out.nam &
exit 0
}
$ns at 10.0 “finish”
$ns run
Please follow and like us: