Untitled Document
Untitled Document
Networking commands help transfer data and connect computers. They are used for
diagnostics, communication, and troubleshooting.
NS-2 is a network simulator used to test and study how networks work without using real
hardware. It helps researchers and students simulate network behavior like data transfer,
delays, and performance.
Features of NS-2:
What is Tcl?
Tcl (Tool Command Language) is a simple programming language used in NS-2 to write
and run network simulations.
1.
○ Save it as hello_world.tcl
2.
3.
Output:
CopyEdit
Hello, World!
tcl
CopyEdit
set a 5
set b 10
set sum [expr $a + $b]
puts "Sum: $sum"
Output: Sum: 15
tcl
CopyEdit
set count 1
while {$count <= 5} {
puts "Count: $count"
incr count
}
Output: Count: 1, 2, 3, 4, 5
tcl
CopyEdit
set numbers {5 2 8 1 9 3}
set sortedList [lsort $numbers]
puts "Sorted list: $sortedList"
tcl
CopyEdit
puts "Start"
after 2000 { puts "2 seconds passed!" }
Output:
Start
(After 2 seconds)
2 seconds passed!
4o
O
Search
Reason