NS3 Examples

Ns3:

The ns-3 project is implemented in a C++ namespace called ns3.

The C++ using statement introduces the ns-3 namespace into the current (global) declarative region

 

Conversion functions of ns3:

  • StringValue.
  • IntegerValue.
  • UintegerValue.
  • BooleanValue.
  • PointerValue.
  • TimeValue.
  • EnumValue.
  • AddressValue.
  • Ipv4AddressValue.
  • Ipv4MaskValue Mac16AddressValue.
  • Mac48AddressValue.

Ns3 Video Tutorial

Ns3 Video Tutorial – Latest NS3 Projects Output

Ns3 Tutorial

Ns3 Tutorial – Guide to Various Network Projects

Journal Support

Paper Publication for NS3 Simulation Projects

Contact Form

Contact Us- Customized Ns3 Simulator Projects

Ns3 examples code:

This is an simple ns3 examples code.

#include “ns3/core-module.h”

#include “ns3/network-module.h”

#include “ns3/internet-module.h”

#include “ns3/point-to-point-module.h”

#include “ns3/applications-module.h”

using namespace ns3;

NS_LOG_COMPONENT_DEFINE (“FirstScriptExample”);

int main (int argc, char *argv[])

{

Time::SetResolution (Time::NS);

LogComponentEnable (“UdpEchoClientApplication”, LOG_LEVEL_INFO);

LogComponentEnable (“UdpEchoServerApplication”, LOG_LEVEL_INFO);

NodeContainer nodes;

nodes.Create (2);

PointToPointHelper pointToPoint;

pointToPoint.SetDeviceAttribute (“DataRate”, StringValue (“5Mbps”));

pointToPoint.SetChannelAttribute (“Delay”, StringValue (“2ms”));

NetDeviceContainer devices;

devices = pointToPoint.Install (nodes);

InternetStackHelper stack;

stack.Install (nodes);

Ipv4AddressHelper address;

address.SetBase (“10.1.1.0”, “255.255.255.0”);

Ipv4InterfaceContainer interfaces = address.Assign (devices);

UdpEchoServerHelper echoServer (9);

ApplicationContainer serverApps = echoServer.Install (nodes.Get (1));

serverApps.Start (Seconds (1.0));

serverApps.Stop (Seconds (10.0));

UdpEchoClientHelper echoClient (interfaces.GetAddress (1), 9);

echoClient.SetAttribute (“MaxPackets”, UintegerValue (1));

echoClient.SetAttribute (“Interval”, TimeValue (Seconds (1.0)));

echoClient.SetAttribute (“PacketSize”, UintegerValue (1024));

ApplicationContainer clientApps = echoClient.Install (nodes.Get (0));

clientApps.Start (Seconds (2.0));

clientApps.Stop (Seconds (10.0));

Simulator::Run ();

Simulator::Destroy ();

return 0;

}