Stop & Wait (NS2)

set ns [new Simulator] $ns color 1 Blue set nf [open out.nam w] $ns namtrace-all $nf proc finish {} { global ns nf $ns flush-trace close $nf exec nam out.nam & exit 0 } set n0 [$ns node] set n1 [$ns node] $ns at 0.0 “$n0 label \” sender \” ” $ns at 0.0 “$n1 label \”receiver\” ” $ns duplex-link $n0 $n1 1Mb 200ms DropTail … Continue reading Stop & Wait (NS2)

Dynamic Routing (NS2)

set ns [new Simulator] #Define different colors for data flows (for NAM) $ns color 1 Blue $ns color 2 Red $ns rtproto DV #Open the Trace file set file1 [open out.tr w] $ns trace-all $file1 #Open the NAM trace file set file2 [open out.nam w] $ns namtrace-all $file2 #Define a ‘finish’ procedure proc finish {} { global ns file1 file2 $ns flush-trace close $file1 close … Continue reading Dynamic Routing (NS2)