Ns3 Projects for B.E/B.Tech M.E/M.Tech PhD Scholars.  Phone-Number:9790238391   E-mail: ns3simulation@gmail.com

What is First CC in Ns3

               Let’s discuss about the significant processes based on the first CC in network simulator 3.

Step: 1 Create First CC in Ns3

               Initially, we have to create the first CC file and that is stored in the scratch folder in Ns3 along with the functions of file extension .cc.

Implement First CC in Ns3

Step: 2 Simulation Code in First CC

          Hereby, we have highlighted some sample simulation codes based on first cc in network simulator.

  • UDP client server application based communication process
uint16_t port = 4000;
UdpServerHelper server (port);
ApplicationContainer apps = server.Install (n.Get (1));
apps.Start (Seconds (1.0));
apps.Stop (Seconds (10.0));
uint32_t MaxPacketSize = 1024;
Time interPacketInterval = Seconds (0.05);
uint32_t maxPacketCount = 320;
UdpClientHelper client (serverAddress, port);
client.SetAttribute ("MaxPackets", UintegerValue (maxPacketCount));
client.SetAttribute ("Interval", TimeValue (interPacketInterval));
client.SetAttribute ("PacketSize", UintegerValue (MaxPacketSize));
apps = client.Install (n.Get (0));
apps.Start (Seconds (2.0));
apps.Stop (Seconds (10.0));
  • IP configuration process
NS_LOG_INFO ("Assign IP Addresses.");
if (useV6 == false)
Ipv4AddressHelper ipv4;
ipv4.SetBase ("", "");
Ipv4InterfaceContainer i = ipv4.Assign (d);
serverAddress = Address (i.GetAddress (1));
Ipv6AddressHelper ipv6;
ipv6.SetBase ("2001:0000:f00d:cafe::", Ipv6Prefix (64));
Ipv6InterfaceContainer i6 = ipv6.Assign (d);
serverAddress = Address(i6.GetAddress (1,1));
NS_LOG_INFO ("Create Applications.");
  • Include the header files
#include "ns3/core-module.h"
#include "ns3/core-module.h"
#include "ns3/csma-module.h"
#include "ns3/applications-module.h"
#include "ns3/internet-module.h"

Execute First CC in Ns3

            Finally, we have to implement the below mentioned commands in terminal to execute the first CC in Ns3. Additionally, we have demonstrated the results that are acquired through the implementation of commands.

cd /home/research/ns-allinone-3.26/ns-3.26
sudo ./waf --run first --vis
Acquired Outcome of First CC Execution

              Feel free to reach us and clarify your issues based on first CC ns3 coding process.