Created
November 16, 2018 15:49
-
-
Save bikashthapa01/cba888142d0d77ce82b78e52fe288ec2 to your computer and use it in GitHub Desktop.
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 n0 [$ns node] | |
set n1 [$ns node] | |
set n2 [$ns node] | |
set f [open lab1a.tr w] | |
$ns trace-all $f | |
set nf [open lab1a.nam w] | |
$ns namtrace-all $nf | |
$ns duplex-link $n0 $n2 5Mb 2ms DropTail | |
$ns duplex-link $n1 $n2 5Mb 2ms DropTail | |
$ns duplex-link $n0 $n1 1.5Mb 10ms DropTail | |
$ns queue-limit $n0 $n2 10 | |
$ns queue-limit $n1 $n2 10 | |
$ns queue-limit $n0 $n1 10 | |
set udp0 [new Agent/UDP] | |
$ns attach-agent $n0 $udp0 | |
set cbr0 [new Application/Traffic/CBR] | |
$cbr0 attach-agent $udp0 | |
set udp1 [new Agent/UDP] | |
$ns attach-agent $n2 $udp1 | |
set cbr1 [new Application/Traffic/CBR] | |
$cbr0 attach-agent $udp1 | |
set null0 [new Agent/Null] | |
$ns attach-agent $n1 $null0 | |
set null1 [new Agent/Null] | |
$ns attach-agent $n1 $null1 | |
$ns connect $udp0 $null0 | |
$ns connect $udp1 $null1 | |
$ns at 1.0 "$cbr0 start" | |
$ns at 1.1 "$cbr1 start" | |
set tcp [new Agent/TCP] | |
set sink [new Agent/TCPSink] | |
$ns attach-agent $n0 $tcp | |
$ns attach-agent $n2 $sink | |
$ns connect $tcp $sink | |
set ftp [new Application/FTP] | |
$ftp attach-agent $tcp | |
$ns at 1.2 "$ftp start" | |
$ns at 3.0 "finish" | |
proc finish { } { | |
global ns f nf | |
$ns flush-trace | |
close $f | |
close $nf | |
puts "Running Name Command: " | |
exec name lab1.nam & | |
exit 0 | |
} | |
$ns run | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment