Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
13 views
2 pages
lab1.tcl
Uploaded by
suneetha prabhu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF, TXT or read online on Scribd
Download
Save
Save lab1.tcl For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
13 views
2 pages
lab1.tcl
Uploaded by
suneetha prabhu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF, TXT or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save lab1.tcl For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 2
Search
Fullscreen
#Create a simulator object
set ns [ new Simulator ]
#Open the nam trace file
set tf [ open lab1.tr w ]
$ns trace-all $tf
#Open the nam trace file
set nf [ open lab1.nam w ]
$ns namtrace-all $nf
#Define a 'finish' procedure
proc finish { } {
global ns nf tf
$ns flush-trace
exec nam lab1.nam &
close $tf
close $nf
exit 0
}
#Creating nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
#Define different colors and labels for data flows
$ns color 1 "red"
$ns color 2 "blue"
$n0 label "Source/udp0"
$n1 label "Source/udp1"
$n2 label "Router"
$n3 label "Destination/Null"
#Create link between nodes
$ns duplex-link $n0 $n2 100Mb 300ms DropTail
$ns duplex-link $n1 $n2 100Mb 300ms DropTail
$ns duplex-link $n2 $n3 1Mb 300ms DropTail
#Set queue size of links
$ns set queue-limit $n0 $n2 50
$ns set queue-limit $n1 $n2 50
$ns set queue-limit $n2 $n3 5
#Setup a UDP connection
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
# 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 $udp0
#Create a UDP agent and attach it to node n1
set udp1 [new Agent/UDP]
$udp1 set class_ 2
$ns attach-agent $n1 $udp1
# 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 $udp1
#Create a Null agent (a traffic sink) and attach it to node n3
set null0 [new Agent/Null]
$ns attach-agent $n3 $null0
#Connect the traffic sources with the traffic sink
$ns connect $udp0 $null0
$ns connect $udp1 $null0
#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
You might also like
Comm_Net_Lab_Manual_Revised_17Dec2022_Final
PDF
No ratings yet
Comm_Net_Lab_Manual_Revised_17Dec2022_Final
105 pages
Data Communications and Networks Lab File
PDF
No ratings yet
Data Communications and Networks Lab File
32 pages
Practical File
PDF
No ratings yet
Practical File
26 pages
ns2-lecture
PDF
No ratings yet
ns2-lecture
35 pages
Vaibhav Goel
PDF
No ratings yet
Vaibhav Goel
29 pages
Ex - No 8
PDF
No ratings yet
Ex - No 8
7 pages
Chapter 10: Introduction To Network Simulator (NS2) : CDA6530: Performance Models of Computers and Networks
PDF
No ratings yet
Chapter 10: Introduction To Network Simulator (NS2) : CDA6530: Performance Models of Computers and Networks
65 pages
SSH CN Report
PDF
No ratings yet
SSH CN Report
33 pages
scenario4a.tcl
PDF
No ratings yet
scenario4a.tcl
3 pages
Computer Networks LAB Manual
PDF
No ratings yet
Computer Networks LAB Manual
28 pages
Lab 1
PDF
No ratings yet
Lab 1
3 pages
CNLABFINAL (v2) PDF
PDF
No ratings yet
CNLABFINAL (v2) PDF
36 pages
Netanim - Program
PDF
No ratings yet
Netanim - Program
4 pages
Simulation of congestion control algorithim
PDF
No ratings yet
Simulation of congestion control algorithim
13 pages
Lab Program1
PDF
No ratings yet
Lab Program1
8 pages
Xgraph
PDF
No ratings yet
Xgraph
7 pages
Wireless Networking and Systems: ns2 Tutorial
PDF
No ratings yet
Wireless Networking and Systems: ns2 Tutorial
34 pages
ns2 Lecture
PDF
No ratings yet
ns2 Lecture
34 pages
Ns2 Lecture
PDF
No ratings yet
Ns2 Lecture
34 pages
NS2 Simulation Tutorial
PDF
No ratings yet
NS2 Simulation Tutorial
14 pages
Program 1
PDF
No ratings yet
Program 1
7 pages
Exp 1 1
PDF
No ratings yet
Exp 1 1
5 pages
Wcn Programs
PDF
No ratings yet
Wcn Programs
7 pages
CN Lab Programs
PDF
No ratings yet
CN Lab Programs
21 pages
NS2 Program
PDF
No ratings yet
NS2 Program
24 pages
Ns2 Programs
PDF
No ratings yet
Ns2 Programs
19 pages
SN Labwork Whole
PDF
0% (1)
SN Labwork Whole
34 pages
Experiment No:09: Name Tarun Shetty Class Be Extc B Batch B2 Roll No. 54
PDF
No ratings yet
Experiment No:09: Name Tarun Shetty Class Be Extc B Batch B2 Roll No. 54
9 pages
ex11
PDF
No ratings yet
ex11
8 pages
CN Lab
PDF
No ratings yet
CN Lab
7 pages
CN Exp7
PDF
No ratings yet
CN Exp7
3 pages
Test 1
PDF
No ratings yet
Test 1
3 pages
Exp 1
PDF
No ratings yet
Exp 1
3 pages
NS2 Documentation
PDF
No ratings yet
NS2 Documentation
15 pages
Network Simulator
PDF
No ratings yet
Network Simulator
10 pages
CN Programs On NS2
PDF
No ratings yet
CN Programs On NS2
16 pages
LAB EXPERIMENT-5
PDF
No ratings yet
LAB EXPERIMENT-5
7 pages
#Mesh Topology
PDF
No ratings yet
#Mesh Topology
7 pages
Aim: To Install and Configure Network Simulator and Learn Basics of TCL Scripting
PDF
No ratings yet
Aim: To Install and Configure Network Simulator and Learn Basics of TCL Scripting
7 pages
Lab 7
PDF
No ratings yet
Lab 7
15 pages
Program 9
PDF
No ratings yet
Program 9
2 pages
S11 20 Udp
PDF
No ratings yet
S11 20 Udp
8 pages
Unit 4 Simulation Basics
PDF
No ratings yet
Unit 4 Simulation Basics
6 pages
Simple.tcl
PDF
No ratings yet
Simple.tcl
1 page
Ns2 Exp 2 Merged
PDF
No ratings yet
Ns2 Exp 2 Merged
3 pages
Computer Networks
PDF
No ratings yet
Computer Networks
2 pages
Exercises 1. Simple NS2 Program
PDF
No ratings yet
Exercises 1. Simple NS2 Program
9 pages
SEE Online Letter
PDF
No ratings yet
SEE Online Letter
2 pages
Routingalgo TCL
PDF
No ratings yet
Routingalgo TCL
2 pages
Simulation of Udp Using NS2
PDF
No ratings yet
Simulation of Udp Using NS2
3 pages
Computer Networks ns2
PDF
No ratings yet
Computer Networks ns2
20 pages
EXP
PDF
No ratings yet
EXP
7 pages
CN Lab 1
PDF
No ratings yet
CN Lab 1
1 page
All TCL Scripts
PDF
No ratings yet
All TCL Scripts
3 pages
TCP UDP Program
PDF
No ratings yet
TCP UDP Program
2 pages
"$cbr0 Start" "$cbr0 Stop"
PDF
No ratings yet
"$cbr0 Start" "$cbr0 Stop"
1 page
Ns-2 Network Simulator An Introduction
PDF
No ratings yet
Ns-2 Network Simulator An Introduction
27 pages
Basic Code
PDF
No ratings yet
Basic Code
2 pages
Profound Python Data Science
From Everand
Profound Python Data Science
Onder Teker
No ratings yet
CISCO PACKET TRACER LABS: Best practice of configuring or troubleshooting Network
From Everand
CISCO PACKET TRACER LABS: Best practice of configuring or troubleshooting Network
Mulayam Singh
No ratings yet