Simple NS2 Programs


How to write Simple NS2 Programs for creating two Nodes?

In Network Simulator 2 ,an event scheduler keeps track of simulation time which is helpful foe firing all events in scheduled queue with current time.It is usually carried to invoke appropriate network components.We have successfully delivered simple ns2 programs for engineering students and research scholars.we assist students in creating simple ns2 programs according to their requirement. we ensure quality within specified time for delivering simple ns2 programs for clients with guaranteed output as excepted.

 

Simple ns2 program code for how to create two nodes and made connection between then them using links and queues.

 

#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 –a 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 1Mb 10ms DropTail
#Call the finish procedure after 5 seconds of simulation time
$ns at 5.0 "finish"
#Run the simulation
$ns run 

Journal Support for Simple NS2 Programs:

NS2-Projects-Journal-Support