Lab 7
Lab 7
ABHIJEET NAWALE
16BCE2126
CSE1004:L31+32
EXPERIMENT NO-7
1. Construct point-to-point topology in which the agent should be UDP.
Simulate the Network scenario and analyse the network
performance.
Code:
# create a simulator Object
set ns [new Simulator]
# finish procedure that closes the trace file and starts nam
proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam out.nam &
exit 0
}
# connection between the two nodes with bandwidth of 1 Megabits, delay of 10ms and a DropTail
queue
$ns duplex-link $n0 $n1 1Mb 10ms DropTail
Output:
3. Construct Dumbell topology for measuring congestion in the
network. Measure Congestion window using Xgraph. Simulate the
Network scenario and analyse the network performance.
Code:
#Create a simulator object
set ns [new Simulator]
puts $wndt "[$ns now] [$tcp1 set cwnd_] $bytesperslot1 [$tcp2 set cwnd_] $bytesperslot2"
$ns at 5 "finish"
Output:
2. Construct STAR Topology and create 2 flows where, one flow should
be using TCP, another flow using UDP. Simulate the Network
scenario and analyse the network performance
Code:
#simple.tcl
#create scheduler
set ns [new Simulator]
#choose colors
$ns color 0 blue
$ns color 1 red
$ns color 2 green
#turn tracing on
set f [open simple.tr w]
$ns trace-all $f
set nf [open simple.nam w]
$ns namtrace-all $nf
#create topology
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
#$ns at 5.0 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink"
$ns run
Output: