SN Labwork Whole
SN Labwork Whole
SN Labwork Whole
Aim:-Consider a small network with five nodes n0,n1, n2, n3, n4, forming a star topology. The node n4 is at the center. Node n0 is a TCP source, which transmits packets to node n3 (a TCP sink) through the node n4. Node n1 is another traffic source, and sends UDP packets to node n2 through n4. The duration of the simulation time is 10 seconds. Write a Tclscript to simulate this scenario.
#Create a simulator object set ns [new Simulator] #Define different colors for data flows $ns color 1 Blue $ns color 2 Red #Open the nam trace file set nf [open out.nam w] $ns namtrace-all $nf #Define a 'finish' procedure proc finish {} { global ns nf $ns flush-trace #Close the trace file close $nf #Execute nam on the trace file exec nam out.nam & exit 0 } #Create four nodes set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] set n4 [$ns node] #Create links between the nodes $ns duplex-link $n0 $n4 1Mb 10ms $ns duplex-link $n1 $n4 1Mb 10ms $ns duplex-link $n2 $n4 1Mb 10ms $ns duplex-link $n3 $n4 2Mb 10ms $ns $ns $ns $ns duplex-link-op duplex-link-op duplex-link-op duplex-link-op $n0 $n1 $n2 $n3 $n4 $n4 $n4 $n4 DropTail DropTail SFQ SFQ right-up right-down left-down left-up
#Monitor the queue for the link between node 2 and node 3 Rollno-M11CE09 Page 1
$ns duplex-link-op $n4 $n3 queuePos 0.5 $ns duplex-link-op $n4 $n2 queuePos 0.5 #Create a TCP agent and attach it to node n0 set tcp0 [new Agent/TCP] $tcp0 set class_ 1 $ns attach-agent $n0 $tcp0 # Create a CBR traffic source and attach it to udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 set packetSize_ 500 $cbr0 set interval_ 0.005 $cbr0 attach-agent $tcp0 #Create a UDP agent and attach it to node n1 set udp0 [new Agent/UDP] $udp0 set class_ 2 $ns attach-agent $n1 $udp0 # Create a CBR traffic source and attach it to udp1 set cbr1 [new Application/Traffic/CBR] $cbr1 set packetSize_ 500 $cbr1 set interval_ 0.005 $cbr1 attach-agent $udp0 #Create a Null agent (a traffic sink) and attach it to node n3 set tsink0 [new Agent/TCPSink] $ns attach-agent $n2 $tsink0 set null1 [new Agent/Null] $ns attach-agent $n3 $null1 #Connect the traffic sources with the traffic sink $ns connect $tcp0 $tsink0 $ns connect $udp0 $null1 #Schedule events for the CBR agents $ns at 0.5 "$cbr0 start" $ns at 1.0 "$cbr1 start" $ns at 4.0 "$cbr1 stop" $ns at 4.5 "$cbr0 stop" #Call the finish procedure after 5 seconds of simulation time $ns at 5.0 "finish" #Run the simulation $ns run
Rollno-M11CE09
Page 2
Practical-02
Aim:- Aim:- Consider a client and a server. The server is running a FTP application (over TCP). The client sends a request to download a file of size 10 MB from the server. Write a script to simulate this scenario. Let node #0 be the server and node #1 be the client. TCP packetsize is 1500 B. Assume typical values for other parameters.
#Create a simulator object set ns [new Simulator] #Open the nam trace file set nf [open out.nam w] $ns namtrace-all $nf #Define a 'finish' procedure proc finish {} { global ns nf $ns flush-trace #Close the trace file close $nf #Execute nam on the trace file exec nam out.nam & exit 0 } #Create two nodes set n0 [$ns node] set n1 [$ns node] #Create a duplex link between the nodes $ns duplex-link $n0 $n1 10Mb 10ms DropTail # Insert your own code for topology creation # and agent definitions, etc. here set src [new Agent/TCP] set sink [new Agent/TCPSink] $ns attach-agent $n0 $src $ns attach-agent $n1 $sink $ns connect $src $sink $src set packetSize_ 1500 $src listen # $src set window 100 set ftp1 [new Application/FTP] $ftp1 attach-agent $src # $ftp1 produce 6850 Rollno-M11CE09 Page 3
set n [expr 10*1024*1024] $ns at 1.0 "$ftp1 start" $ns at 1.5 "$ftp1 send n" $ns at 3.0 "$ftp1 stop" #Call the finish procedure after 5 seconds simulation time $ns at 10.0 "finish" #Run the simulation $ns run
Rollno-M11CE09
Page 4
Practical-03 Part-A
Write a .tcl file for various TCP flavors (1) TCP Reno (2) TCP New Reno (3) TCP Sack (4) TCP Taheo (5) TCP Vegas
Scenario-1
set ns [new Simulator] #Define different colors for data flows (for NAM) $ns color 1 Blue $ns color 2 Red #Open the Trace files set file1 [open out.tr w] set winfile [open WinFile 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 $file2 exec nam out.nam & exit 0 } #Create six set n0 [$ns set n1 [$ns set n2 [$ns set n3 [$ns set n4 [$ns set n5 [$ns nodes node] node] node] node] node] node]
Rollno-M11CE09
Page 5
duplex-link $n0 $n2 2Mb 10ms DropTail duplex-link $n1 $n2 2Mb 10ms DropTail simplex-link $n2 $n3 0.3Mb 100ms DropTail simplex-link $n3 $n2 0.3Mb 100ms DropTail duplex-link $n3 $n4 0.5Mb 40ms DropTail duplex-link $n3 $n5 0.5Mb 30ms DropTail
#Give node position (for NAM) $ns duplex-link-op $n0 $n2 orient right-down $ns duplex-link-op $n1 $n2 orient right-up $ns simplex-link-op $n2 $n3 orient right $ns simplex-link-op $n3 $n2 orient left $ns duplex-link-op $n3 $n4 orient right-up $ns duplex-link-op $n3 $n5 orient right-down #Set Queue Size of link (n2-n3) to 10 $ns queue-limit $n2 $n3 20 #Setup a TCP connection set tcp [new Agent/TCP/Vegas] $ns attach-agent $n0 $tcp set sink [new Agent/TCPSink/DelAck] $ns attach-agent $n4 $sink $ns connect $tcp $sink $tcp set fid_ 1 $tcp set window_ 8000 $tcp set packetSize_ 552 #Setup a FTP over TCP connection set ftp [new Application/FTP] $ftp attach-agent $tcp $ftp set type_ FTP #Setup a UDP connection set udp [new Agent/UDP] $ns attach-agent $n1 $udp set null [new Agent/Null] $ns attach-agent $n5 $null $ns connect $udp $null $udp set fid_ 2 #Setup a CBR over UDP connection set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $cbr set type_ CBR $cbr set packet_size_ 1000 $cbr set rate_ 0.01mb $cbr set random_ false $ns $ns $ns $ns at at at at 0.1 "$cbr start" 1.0 "$ftp start" 124.0 "$ftp stop" 124.5 "$cbr stop"
Rollno-M11CE09
Page 6
# tcp source node, will be called here "tcp", # and the name of output file. proc plotWindow {tcpSource file} { global ns set time 0.1 set now [$ns now] set cwnd [$tcpSource set cwnd_] set wnd [$tcpSource set window_] puts $file "$now $cwnd" $ns at [expr $now+$time] "plotWindow $tcpSource $file" } $ns at 0.1 "plotWindow $tcp $winfile" $ns at 125.0 "finish" $ns run
Rollno-M11CE09
Page 7
Reno
Newreno
Rollno-M11CE09
Page 8
Vegas
Sack1
Rollno-M11CE09
Page 9
Scenariao-2
set ns [new Simulator] #Define different colors for data flows (for NAM) $ns color 1 Blue $ns color 2 Red #Open the Trace files set file1 [open out.tr w] set winfile [open WinFile 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 $file2 exec nam out.nam & exit 0 } #Create six set n0 [$ns set n1 [$ns set n2 [$ns set n3 [$ns set n4 [$ns set n5 [$ns nodes node] node] node] node] node] node]
#Create links between the nodes $ns duplex-link $n0 $n2 2Mb 10ms DropTail $ns duplex-link $n1 $n2 2Mb 10ms DropTail $ns simplex-link $n2 $n3 2Mb 100ms DropTail $ns simplex-link $n3 $n2 1Mb 100ms DropTail $ns duplex-link $n3 $n4 2Mb 40ms DropTail $ns duplex-link $n3 $n5 2Mb 30ms DropTail #Give node position (for NAM) $ns duplex-link-op $n0 $n2 orient right-down $ns duplex-link-op $n1 $n2 orient right-up $ns simplex-link-op $n2 $n3 orient right $ns simplex-link-op $n3 $n2 orient left $ns duplex-link-op $n3 $n4 orient right-up $ns duplex-link-op $n3 $n5 orient right-down #Set Queue Size of link (n2-n3) to 10 $ns queue-limit $n2 $n3 20 #Setup a TCP connection
Rollno-M11CE09
Page 10
set tcp [new Agent/TCP/Vegas] $ns attach-agent $n0 $tcp set sink [new Agent/TCPSink] $ns attach-agent $n4 $sink $ns connect $tcp $sink $tcp set fid_ 1 $tcp set window_ 8000 $tcp set packetSize_ 552 #Setup a FTP over TCP connection set ftp [new Application/FTP] $ftp attach-agent $tcp $ftp set type_ FTP #Setup a UDP connection set udp [new Agent/UDP] $ns attach-agent $n1 $udp set null [new Agent/Null] $ns attach-agent $n5 $null $ns connect $udp $null $udp set fid_ 2 #Setup a CBR over UDP connection set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $cbr set type_ CBR $cbr set packet_size_ 1000 $cbr set rate_ 0.01mb $cbr set random_ false $ns $ns $ns $ns at at at at 0.1 "$cbr start" 1.0 "$ftp start" 124.0 "$ftp stop" 124.5 "$cbr stop"
# next procedure gets two arguments: the name of the # tcp source node, will be called here "tcp", # and the name of output file. proc plotWindow {tcpSource file} { global ns set time 0.1 set now [$ns now] set cwnd [$tcpSource set cwnd_] set wnd [$tcpSource set window_] puts $file "$now $cwnd" $ns at [expr $now+$time] "plotWindow $tcpSource $file" } $ns at 0.1 "plotWindow $tcp $winfile" $ns at 125.0 "finish" $ns run
Rollno-M11CE09
Page 11
Conclusion:- average window size of vegas is more compared to other tcp flavers and after
some time window size of vegas become constant.
Rollno-M11CE09
Page 12
Conclusion:- for the large queue size the average window size become more by reducing the
number of times going into the slowstart pahse.
Rollno-M11CE09
Page 13
Part-C
Bottleneck bw 1mb(scenario-1)
Rollno-M11CE09
Page 14
Practical-04
To analyze the throughput achieved by Various TCP flavours (1) TCP Reno (2) TCP New Reno (3) TCP Sack (4) TCP Taheo (5) TCP Vegas Part-A
Scenario-1
set ns [new Simulator] #Define different colors for data flows (for NAM) $ns color 1 Blue $ns color 2 Red #Open the Trace files set file1 [open out.tr w] set winfile [open WinFile 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 $file2 exec nam out.nam & exit 0 } #Create six set n0 [$ns set n1 [$ns set n2 [$ns set n3 [$ns set n4 [$ns set n5 [$ns nodes node] node] node] node] node] node]
#Create links between the nodes $ns duplex-link $n0 $n2 2Mb 10ms DropTail
Rollno-M11CE09
Page 15
duplex-link $n1 $n2 2Mb 10ms DropTail simplex-link $n2 $n3 0.3Mb 100ms DropTail simplex-link $n3 $n2 0.3Mb 100ms DropTail duplex-link $n3 $n4 0.5Mb 40ms DropTail duplex-link $n3 $n5 0.5Mb 30ms DropTail
#Give node position (for NAM) $ns duplex-link-op $n0 $n2 orient right-down $ns duplex-link-op $n1 $n2 orient right-up $ns simplex-link-op $n2 $n3 orient right $ns simplex-link-op $n3 $n2 orient left $ns duplex-link-op $n3 $n4 orient right-up $ns duplex-link-op $n3 $n5 orient right-down #Set Queue Size of link (n2-n3) to 10 $ns queue-limit $n2 $n3 20 #Setup a TCP connection set tcp [new Agent/TCP/Vegas] $ns attach-agent $n0 $tcp set sink [new Agent/TCPSink/DelAck] $ns attach-agent $n4 $sink $ns connect $tcp $sink $tcp set fid_ 1 $tcp set window_ 8000 $tcp set packetSize_ 552 #Setup a FTP over TCP connection set ftp [new Application/FTP] $ftp attach-agent $tcp $ftp set type_ FTP #Setup a UDP connection set udp [new Agent/UDP] $ns attach-agent $n1 $udp set null [new Agent/Null] $ns attach-agent $n5 $null $ns connect $udp $null $udp set fid_ 2 #Setup a CBR over UDP connection set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $cbr set type_ CBR $cbr set packet_size_ 1000 $cbr set rate_ 0.01mb $cbr set random_ false $ns $ns $ns $ns at at at at 0.1 "$cbr start" 1.0 "$ftp start" 124.0 "$ftp stop" 124.5 "$cbr stop"
# next procedure gets two arguments: the name of the # tcp source node, will be called here "tcp",
Rollno-M11CE09
Page 16
# and the name of output file. proc plotWindow {tcpSource file} { global ns set time 0.1 set now [$ns now] set cwnd [$tcpSource set cwnd_] set wnd [$tcpSource set window_] puts $file "$now $cwnd" $ns at [expr $now+$time] "plotWindow $tcpSource $file" } $ns at 0.1 "plotWindow $tcp $winfile" $ns at 125.0 "finish" $ns run
Throughput at node-2
New reno
Rollno-M11CE09
Page 17
Reno
Sack
Rollno-M11CE09
Page 18
Tcp tahoe
Vegas
Rollno-M11CE09
Page 19
Scenariao-2
set ns [new Simulator] #Define different colors for data flows (for NAM) $ns color 1 Blue $ns color 2 Red #Open the Trace files set file1 [open out.tr w] set winfile [open WinFile 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 $file2 exec nam out.nam & exit 0 } #Create six set n0 [$ns set n1 [$ns set n2 [$ns set n3 [$ns set n4 [$ns set n5 [$ns nodes node] node] node] node] node] node]
#Create links between the nodes $ns duplex-link $n0 $n2 2Mb 10ms DropTail $ns duplex-link $n1 $n2 2Mb 10ms DropTail $ns simplex-link $n2 $n3 2Mb 100ms DropTail $ns simplex-link $n3 $n2 1Mb 100ms DropTail $ns duplex-link $n3 $n4 2Mb 40ms DropTail $ns duplex-link $n3 $n5 2Mb 30ms DropTail #Give node position (for NAM) $ns duplex-link-op $n0 $n2 orient right-down $ns duplex-link-op $n1 $n2 orient right-up $ns simplex-link-op $n2 $n3 orient right $ns simplex-link-op $n3 $n2 orient left $ns duplex-link-op $n3 $n4 orient right-up $ns duplex-link-op $n3 $n5 orient right-down #Set Queue Size of link (n2-n3) to 10 $ns queue-limit $n2 $n3 20 #Setup a TCP connection
Rollno-M11CE09
Page 20
set tcp [new Agent/TCP/Vegas] $ns attach-agent $n0 $tcp set sink [new Agent/TCPSink] $ns attach-agent $n4 $sink $ns connect $tcp $sink $tcp set fid_ 1 $tcp set window_ 8000 $tcp set packetSize_ 552 #Setup a FTP over TCP connection set ftp [new Application/FTP] $ftp attach-agent $tcp $ftp set type_ FTP #Setup a UDP connection set udp [new Agent/UDP] $ns attach-agent $n1 $udp set null [new Agent/Null] $ns attach-agent $n5 $null $ns connect $udp $null $udp set fid_ 2 #Setup a CBR over UDP connection set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $cbr set type_ CBR $cbr set packet_size_ 1000 $cbr set rate_ 0.01mb $cbr set random_ false $ns $ns $ns $ns at at at at 0.1 "$cbr start" 1.0 "$ftp start" 124.0 "$ftp stop" 124.5 "$cbr stop"
# next procedure gets two arguments: the name of the # tcp source node, will be called here "tcp", # and the name of output file. proc plotWindow {tcpSource file} { global ns set time 0.1 set now [$ns now] set cwnd [$tcpSource set cwnd_] set wnd [$tcpSource set window_] puts $file "$now $cwnd" $ns at [expr $now+$time] "plotWindow $tcpSource $file" } $ns at 0.1 "plotWindow $tcp $winfile" $ns at 125.0 "finish" $ns run
Rollno-M11CE09
Page 21
Rollno-M11CE09
Page 22
Conclusion:- from above we can conclude that the performance of the different flaver of tcp
are as bellow in increasing order 1)vegas 2)sack1 3) newreno 4)reno 5) tahoe
Due to the losses tahoe goes into the slowstart several times. Due to the time out because of losses reno goes into slowstart several times. The newreno ,vegas and seck1 perform good.
Rollno-M11CE09
Page 23
Conclusion:- for the larger queue size the throughput of tcp(tahoe) is increase by readucing
the number of times going in to slow start phase.
Rollno-M11CE09
Page 24
Rollno-M11CE09
Page 25
Conclusion:- As the window size increases the throughput also increase upto certain initial
values of window size.
Rollno-M11CE09
Page 26
Practical-05
Aim:-to study fairness issue between tcp and udp .
Fairness issue( tcp and udp):set ns [new Simulator] #Define different colors for data flows (for NAM) $ns color 1 Blue $ns color 2 Red #Open the Trace files set file1 [open out.tr w] set winfile [open WinFile 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 $file2 exec nam out.nam & exit 0 } #Create six set n0 [$ns set n1 [$ns set n2 [$ns set n3 [$ns set n4 [$ns set n5 [$ns nodes node] node] node] node] node] node]
#Create links between the nodes $ns duplex-link $n0 $n2 2Mb 10ms DropTail $ns duplex-link $n1 $n2 2Mb 10ms DropTail $ns simplex-link $n2 $n3 2Mb 100ms DropTail $ns simplex-link $n3 $n2 1Mb 100ms DropTail $ns duplex-link $n3 $n4 2Mb 40ms DropTail $ns duplex-link $n3 $n5 2Mb 30ms DropTail #Give node position (for NAM) $ns duplex-link-op $n0 $n2 orient right-down $ns duplex-link-op $n1 $n2 orient right-up $ns simplex-link-op $n2 $n3 orient right $ns simplex-link-op $n3 $n2 orient left
Rollno-M11CE09
Page 27
$ns duplex-link-op $n3 $n4 orient right-up $ns duplex-link-op $n3 $n5 orient right-down #Set Queue Size of link (n2-n3) to 10 $ns queue-limit $n2 $n3 20 #Setup a TCP connection set tcp [new Agent/TCP/Vegas] $ns attach-agent $n0 $tcp set sink [new Agent/TCPSink] $ns attach-agent $n4 $sink $ns connect $tcp $sink $tcp set fid_ 1 $tcp set window_ 20 $tcp set packetSize_ 1000 #Setup a FTP over TCP connection set ftp [new Application/FTP] $ftp attach-agent $tcp $ftp set type_ FTP #Setup a UDP connection set udp [new Agent/UDP] $ns attach-agent $n1 $udp set null [new Agent/Null] $ns attach-agent $n5 $null $ns connect $udp $null $udp set fid_ 2 #Setup a CBR over UDP connection set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $cbr set type_ CBR $cbr set packet_size_ 1000 $cbr set rate_ 0.01mb $cbr set random_ false $ns $ns $ns $ns at at at at 0.1 "$cbr start" 1.0 "$ftp start" 124.0 "$ftp stop" 124.5 "$cbr stop"
# next procedure gets two arguments: the name of the # tcp source node, will be called here "tcp", # and the name of output file. proc plotWindow {tcpSource file} { global ns set time 0.1 set now [$ns now] set cwnd [$tcpSource set cwnd_] set wnd [$tcpSource set window_] puts $file "$now $cwnd" $ns at [expr $now+$time] "plotWindow $tcpSource $file" } $ns at 0.1 "plotWindow $tcp $winfile"
Rollno-M11CE09
Page 28
Results:- 01
number of tcp packets sent:7764 lost:0 recived:7764 number of udp packets sent:156 lost:0 recived:156 number of tcp bytes transfered:8074560 number of udp bytes transfered:156000 tcp utilization:0.516791 Mbps udp utilization:0.009984 Mbps tcp performance:172.905620 udp performance:3.340526
Rollno-M11CE09
Page 29
Conclusion:- when udp and tcp use same channel for sufficient load the link utilization by udp is more as compared to tcp.
Rollno-M11CE09
Page 30
Practical-06
Aim:-Consider an INSAT-3A multipurpose geostationary satellite and two satellite terminals, one at Bangkok and the other at Baghdad. The position of Bangkok is 13.9 degree latitude north and100.9 degree longitude east. The position of Baghdad is 33.8 degree latitude north and 44.4 degree longitude east. INSAT-3A is used to provide television broadcasting from Bangkok to Baghdad. INSAT-3A is positioned at 93.5 degrees longitude East. The traffic consists of a FTP source and a CBR stream. The simulation lasts for 50 secs. Analyze the trace file and find the following: End-to-end delay between two terminals What is the nature of the delay that you expect in this scenario
global ns set ns [new Simulator] # Global configuration parameters # Set these global options for the satellite terminals global opt set opt(chan) Channel/Sat set opt(bw_up) 2Mb set opt(bw_down) 2Mb set opt(phy) Phy/Sat set opt(mac) Mac/Sat set opt(ifq) Queue/DropTail set opt(qlim) 50 set opt(ll) LL/Sat set opt(wiredRouting) OFF # This tracing enabling must precede link and node creation set outfile [open outinsatsol.tr w] $ns trace-all $outfile
Rollno-M11CE09 Page 31
# Set up satellite and terrestrial nodes # Configure the node generator for bent-pipe satellite # geo-repeater uses type Phy/Repeater $ns node-config -satNodeType geo-repeater \ -phyType Phy/Repeater \ -channelType $opt(chan) \ -downlinkBW $opt(bw_down) \ -wiredRouting $opt(wiredRouting) # GEO satellite at 93.5 degrees longitude East set n1 [$ns node] $n1 set-position 93.5 # Configure the node generator for satellite terminals $ns node-config -satNodeType terminal \ -llType $opt(ll) \ -ifqType $opt(ifq) \ -ifqLen $opt(qlim) \ -macType $opt(mac) \ -phyType $opt(phy) \ -channelType $opt(chan) \ -downlinkBW $opt(bw_down) \ -wiredRouting $opt(wiredRouting) # Two terminals: one in Bangkok and one in Baghdad set n2 [$ns node] $n2 set-position 13.9 100.9; # BK set n3 [$ns node] $n3 set-position 33.8 44.4; # BD # Add GSLs to geo satellites $n2 add-gsl geo $opt(ll) $opt(ifq) $opt(qlim) $opt(mac) $opt(bw_up) \ $opt(phy) [$n1 set downlink_] [$n1 set uplink_] $n3 add-gsl geo $opt(ll) $opt(ifq) $opt(qlim) $opt(mac) $opt(bw_up) \ $opt(phy) [$n1 set downlink_] [$n1 set uplink_] $ns trace-all-satlinks $outfile
Rollno-M11CE09 Page 32
# Attach agents for CBR traffic generator set udp0 [new Agent/UDP] $ns attach-agent $n2 $udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 attach-agent $udp0 $cbr0 set interval_ 6 set null0 [new Agent/Null] $ns attach-agent $n3 $null0 $ns connect $udp0 $null0 # Attach agents for FTP set tcp1 [$ns create-connection TCP $n2 TCPSink $n3 0] set ftp1 [$tcp1 attach-app FTP] $ns at 7.0 "$ftp1 produce 100" # We use centralized routing set satrouteobject_ [new SatRouteObject] $satrouteobject_ compute_routes $ns at 1.0 "$cbr0 start" $ns at 100.0 "finish" proc finish {} { global ns outfile $ns flush-trace close $outfile exit 0 } $ns run
Rollno-M11CE09
Page 33
Output:
Rollno-M11CE09
Page 34