NS2 Simulation Code is an initiative started with the help of top experts and technocrats from all over the world in a Nobel goal to offer code support to the budding students.  We also offer complete support regarding Simulation code i.e. we offer code for your projects, assignments and research work in NS-2. It is also an open source Network simulator, also which is mainly focused at research and education purpose. We also have nearly 100+ networking engineers working with Ns-2 for students from all over the world.

We also have developed nearly 1000+ concepts in Ns-2 and at present working on more than 500+ innovative concepts. Also, We have provided few major concepts and languages used in NS-2. This will give you also an idea about our NS2 code support. If you need code also for any particular topic, approach us through our online service.


  • Scripting language with features like simple syntax, platform independent and easy integration also with other languages.
  • Used to design and implement the major components also used in Networking.
-It is used to design
  • Node configuration
  • Node creation
  • Initializing color and also shapes of nodes
  • To locate also the node
  • Link creation
  • Initializing size for nodes
  • Topology creation
  • For establishing TCP Connection
  • Initializing colors also to links
  • Initializing Packet transmission
  • Core programming language also for backend operations
  • OTCl[Object oriented extension of TCL] is written in C++
  • Used to define also in the internal mecahnism
  • Routing protocols[like Link state Routing etc]
  • Security related algorithms[RSA, ECC etc]
  • Clustering algorithms[e.g K-Means Clustering]
  • Handover Mechanism[e.g Vertical handover/horizontal handover]
  • Error Correction[e.g Forward Error Correction Method]
  • Queuing Models[Eg First In first Out]
  • Congestion Control Mechanism
  • Load balancing also in algorithms
  • Scheduling Techniques

       Among the above mentioned concepts, we also have taken Congestion control mechanism to explain you how to implement a particular concept in NS2. Similarly, you can take other concepts and work on it or in case of doubt approach us through mail or call, we will also back to you with your need.

Congestion Control Mechanism in NS-2

   Congestion control is a state, which also occurs when a part of network message traffic is so heavy that it slows down the overall network response time. It is a global issue also which overloads a part of Network [Subnet] and leads to traffic congestion problem. Queuing algorithms can also used to overcome this problem.

Few major congestion algorithms/protocols are:
  • Choke Algorithm
  • Random Early detection Algorithm
  • Random Exponential Marking also in Algorithm
  • Drop tail also in algorithm
  • Fair Queuing Algorithm
  • Adaptive Virtual Queue also in Algorithm
  • Virtual Queue Algorithm
  • Rate based congestion control also in protocol
  • Single Rate congestion protocol
  • Window based congestion control protocol
  • Multi Rate congestion also in protocol

      These are also the few major congestion control algorithms used to overcome congestion problem in Network. You can also approach us for any particular code also for the above mentioned algorithms or any other codes, as per your need. We are also ready to support for all types of protocols, concepts and algorithms used in networking applications. Now, let’s have also a glance over an example code also for TCP congestion control in NS2.

Example NS-2 Simulation Code –  TCP Congestion control in Wired Network[In TCL]

#create links between the nodes

$ns duplex-link $node1 $node2 5Mb 15ms SFQ

$ ns duplex-link $node2 $node3 10Mb 12ms SFQ

#Set Queue Size of link

$ns queue-limit $node2 $node3 5

#Setup a TCP connection

set tcpcon [new Agent/TCP/Sack1]

$ns attach-agent $node1 $tcpcon

set sink [new Agent/TCPSink/Sack1]

$ns attach-agent $node1 $sink

$ ns connect $tcpcon $sink

$tcp set fid_ 1

$ tcp set window_ 8000

$tcp set packetSize_ 500

#Setup a FTP over TCP connection

set ftpcon [new Application/FTP]

$ftpcon attach-agent $tcpcon

$ ftpcon set type_ FTP

#Setup a UDP connection

set udpcon [new Agent/UDP]

$netsim attach-agent $node1 $udpcon

set null [new Agent/Null]

$ netsim attach-agent $n5 $null

$netsim connect $udpcon $null

$udpcon set fid_ 2

#Setup a CBR over UDP connection

set cbrcon [new Application/Traffic/CBR]

$cbrcon attach-agent $udpcon

$ cbrcon set type_ CBR

$cbrcon set packet_size_ 1500

$ cbrcon set rate_ 0.05mb

$cbrcon set random_ false

$ netsim at 0.1 “$cbrcon start”

$netsim at 2.0 “$ftpcon start”

$ netsim at 15.0 “$ftpcon stop”

$netsim at 16.0 “$cbrcon stop”

    Hope you would have got an idea about NS2 simulation code. Here, we have also emphasized on congestion control in NS2 and also provide a example code in it. Similarly, you can take any concept and also approach us, we also will give you respective code support as per your concept. If you need further code support for your projects, research or assignment work, approach us with your topic and also need. We also will guide you in the best way along with the code support.