We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ea069ce commit af481baCopy full SHA for af481ba
Study_Network_Simulator_using_NS2.txt
@@ -0,0 +1,28 @@
1
+set ns [new Simulator]
2
+set nf [open out.nam w]
3
+$ns namtrace-all $nf
4
+proc finish {} {
5
+ global ns nf
6
+ $ns flush-trace
7
+ #Close the trace file
8
+ close $nf
9
+ #Execute nam on the trace file
10
+ exec nam out.nam &
11
+ exit 0
12
+}
13
+set n0 [$ns node]
14
+set n1 [$ns node]
15
+$ns duplex-link $n0 $n1 1Mb 10ms DropTail
16
+set udp0 [new Agent/UDP]
17
+$ns attach-agent $n0 $udp0
18
+set cbr0 [new Application/Traffic/CBR]
19
+$cbr0 set packetSize_ 500
20
+$cbr0 set interval_ 0.005
21
+$cbr0 attach-agent $udp0
22
+set null0 [new Agent/Null]
23
+$ns attach-agent $n1 $null0
24
+$ns connect $udp0 $null0
25
+$ns at 0.5 "$cbr0 start"
26
+$ns at 4.5 "$cbr0 stop"
27
+$ns at 5.0 "finish"
28
+$ns run
0 commit comments