Created
November 16, 2018 04:32
-
-
Save bikashthapa01/a8021070c24f34ed16c755720e899062 to your computer and use it in GitHub Desktop.
VTU 15csl57 Network Simulator Program - 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set ns [new Simulator] | |
set nf [open lab1.nam w] | |
$ns namtrace-all $nf | |
set tf [open lab1.tr w] | |
$ns trace-all $tf | |
proc finish { } { | |
global ns nf tf | |
$ns flush-trace | |
close $nf | |
close $tf | |
exec nam lab1.nam & | |
exit 0 | |
} | |
set n0 [$ns node] | |
set n1 [$ns node] | |
set n2 [$ns node] | |
set n3 [$ns node] | |
$ns duplex-link $n0 $n2 200Mb 10ms DropTail | |
$ns duplex-link $n1 $n2 100Mb 5ms DropTail | |
$ns duplex-link $n2 $n3 1Mb 1000ms DropTail | |
$ns queue-limit $n0 $n2 10 | |
$ns queue-limit $n1 $n2 10 | |
set udp0 [new Agent/UDP] | |
$ns attach-agent $n0 $udp0 | |
set cbr0 [new Application/Traffic/CBR] | |
$ns set packetSize_ 500 | |
$ns set interval_ 0.005 | |
$cbr0 attach-agent $udp0 | |
set udp1 [new Agent/UDP] | |
$ns attach-agent $n1 $udp1 | |
set cbr1 [new Application/Traffic/CBR] | |
$cbr1 attach-agent $udp1 | |
set udp2 [new Agent/UDP] | |
$ns attach-agent $n2 $udp2 | |
set cbr2 [new Application/Traffic/CBR] | |
$cbr2 attach-agent $udp2 | |
set null0 [new Agent/Null] | |
$ns attach-agent $n3 $null0 | |
$ns connect $udp0 $null0 | |
$ns connect $udp1 $null0 | |
$ns at 0.1 "$cbr0 start" | |
$ns at 0.2 "$cbr1 start" | |
$ns at 1.0 "finish" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment