0% found this document useful (0 votes)
55 views

Experiment 1 AIM: Introduction To Discrete Event Simulation Tools Ns2/s3, Omnet++ and Installation of Ns3

The document provides an introduction to discrete event network simulation tools Ns2/s3 and Omnet++. It discusses: 1. The normal process of creating a simulation in ns-3 including defining topology, developing models, configuring nodes and links, executing the simulation, and performing analysis. 2. Key features of ns-2 including being open-source, supporting various protocols, and helping understand how protocols work. 3. Key features of ns-3 including being open-source, modular, supporting Linux/macOS, and using C++ and Python. 4. The document introduces Omnet++ as a module-based framework for building network simulations using the C++ programming language.

Uploaded by

Om Dwivedi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

Experiment 1 AIM: Introduction To Discrete Event Simulation Tools Ns2/s3, Omnet++ and Installation of Ns3

The document provides an introduction to discrete event network simulation tools Ns2/s3 and Omnet++. It discusses: 1. The normal process of creating a simulation in ns-3 including defining topology, developing models, configuring nodes and links, executing the simulation, and performing analysis. 2. Key features of ns-2 including being open-source, supporting various protocols, and helping understand how protocols work. 3. Key features of ns-3 including being open-source, modular, supporting Linux/macOS, and using C++ and Python. 4. The document introduces Omnet++ as a module-based framework for building network simulations using the C++ programming language.

Uploaded by

Om Dwivedi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

EXPERIMENT 1

AIM: Introduction to Discrete Event Simulation tools Ns2/s3, Omnet++ and


installation of Ns3.
(I) Ns (from network simulator) is a name for a series of discrete event network simulators,
specifically Ns-1, Ns-2, and Ns-3. All are discrete-event computer network simulators,
primarily used in research and teaching.
The normal process of creating a simulation can be divided into several steps:
1. Definition of Topology: To facilitate the construction of basic facilities and to explain their
relationship, ns-3 has a system of containers and assistants who run this process.
2. Model development: Models added to simulations (for example, UDP, IPv4, point-to-point
devices and links, applications); most of the time this is done using assistants.
Node and link configuration: models set their default values (for example, the size of the
packets sent by the application or the MTU point-to-point link); most of the time this is done
using an attribute system.
3. Execution: Simulation centers produce events, user-requested data is included.
4. Performance analysis: After the simulation is complete and the data is available as a timed
event tracker. This data can be mathematically analyzed with R-like tools to reach a conclusion.
5. Image Visual: Raw or processed data collected in the simulation can be retrieved using
tools such as Gnuplot, matplotlib or XGRAPH.

(II) NS2 (Network Simulator 2): -


NS2 is an open-source simulation tool running on Linux. It is a discrete event network-based
template and provides great support for route simulation, multiple streams and IP protocols and
protocols, such as UDP, TCP, RTP and SRM over wireless and wireless networks (local and
satellite). It has many advantages that make it a useful tool, such as repetition protocols and the
ability to describe in detail network traffic. Additionally, NS2 supports several algorithms for
routing and linearization of LAN routes and streaming is part of the algorithms. Online
algorithms include right line, robin deficit and FIFO. NS2 started as a variant of the REAL
network simulator in 1989 (see Resources). REAL is a network template initially intended to
study the dynamic flow behavior and congestion control schemes of the flexible package data
networks.
NS2 is a tool that helps you better understand certain methods in protocol definitions, such as
overcrowding, hard to see in live testing. Provides excellent documentation and support for
various add-ons. We they recommend NS2 as a tool to help understand how protocols work
and interact with different network topology.

Om Dwivedi 1


(III) NS3 (Network Simulator 3): -
ns-3 is a discrete-event network simulator for Internet systems, targeted primarily for research
and educational use. ns-3 is free, open-source software, licensed under the GNU GPLv2
license, and maintained by a worldwide community.
Ns3 is designed to provide open, scalable network simulation platform, network research and
education. In short, ns-3 provides examples of how packet data networks workand create, and
provide a simulation engine for users to perform simulation tests. Some of the reasons for this
use ns-3 covers to do the most difficult or impossible lessons to do with real programs, learning
program behave in a highly controlled environment, capable of reproducing, and learning how
networks work. Users will see that the available model set in ns-3 focuses on comparing how
Internet protocols and networks work, but ns-3 is not limited in online systems; few users use
ns-3 to create non-internet systems.
Many simulation tools are available for network simulation research. Below are a few
distinguishing features of ns-3 in contrast in other tools.
· NS-3 is designed as a collection of libraries that can be integrated with other external software
libraries. While some simulations provide users with a single, integrated user interface area
where all operations are performed, ns-3 is modular above this. Several external animators and
data analysis tools and visual tools can be used with ns-3. However, users should expect work
on command line and C ++ and / or Python software development tools.
· NS-3 is mainly used for Linux or macOS programs, although BSD support is available
· Windows systems and frameworks that can generate Linux code, such as Windows
Subsystem for Linux, or Cygwin. Native Windows Visual Studio is not currently supported
even though the engineer is working in future support. Windows users can use the Linux virtual
machine.
· NS-3 is not a software product officially supported by any company. Ns3 support is best done
at the ns-3 user forum
Ns-3 is built using C++ and Python with scripting capability. The ns library is wrapped by
Python thanks to the pybindgen library which delegates the parsing of the ns C++ headers to
castxml and pygccxml to automatically generate the corresponding C++ binding glue. These
automatically generated C++ files are finally compiled into the ns Python module to allow
users to interact with the C++ ns models and core through Python scripts. The ns simulator
features an integrated attribute-based system to manage default and per-instance values for
simulation parameters.
When network cards are enabled in the devices, we add different parameters in the channels
(i.e., real world path used to send data) which are data-rate, packet size, etc. Now we use
Application to generate traffic and send the packets using these applications.

Om Dwivedi 2

(IV) Difference between NS3 and NS2: -

(V) Introduction to OMNet ++:

OMNeT ++ (Objective Modular Network Testbed in C ++) is a module-based library


module, based on the C ++ component and the framework, especially for building network
simulations. OMNeT ++ can be used free of charge for non-commercial use imitation as in
educational and teaching institutions. OMNEST is an extended version of OMNeT ++ for
commercial use. OMNeT ++ itself is a simulation framework without models for network
protocols such as IP or HTTP. Main computer network simulation models are available in a
few external frames. The most commonly used INET offers a variety of models for all types of
network protocols and technologies such as IPv6, BGP. INET and provides a set of motion
models to mimic the movement of the node in the simulation. INET models are licensed under
the LGPL or GPL. NED (Network Description) is a topology definition language for OMNeT
++. Managing and reducing the time to make large simulations, additional tools have been
developed, so that for example, based on Python. OMNeT++ offers an Eclipse-based IDE, a
graphical runtime environment, and a host of other tools. There are extensions for real-time
simulation, network emulation, database integration, SystemC integration, and several other
functions. OMNeT++ is distributed under the Academic Public License.

The main ingredients of OMNeT++ are:

Simulation kernel library (C++)


The NED topology description language
Simulation IDE based on the Eclipse platform
Interactive simulation runtime GUI (Qtenv)
Command-line interface for simulation execution (Cmdenv)
Utilities (makefile creation tool, etc.)
Documentation, sample simulations, etc.

Om Dwivedi 3








(VI) Difference between Emulator and Simulator: -

(VII) Ns3 and NetAnim Installation:


Operating System is Community Edition OS (CentOS)
Download ns-allinone-3.20.4.tar.bz2

● Execute the following commands in the terminal


1. tar -xvf 3.20.4.tar.bz2 : This instruction helps in extracting the folders from the zip file.
2. cd ns-allinone-3.20 : Move into the extracted folder
3. ./build.py
4. /waf configure-enable-tests
5. /waf-enable-examples
Copy the file first.cc from examples>tutorials into the scratch folder ensuring you delete all
previous files.
● To run the program Execute the command- /waf-run scratch/first

Om Dwivedi 4

(VIII) Installing NetAnim Animation Simulator
Execute the following commands in the terminal
yum install qt4-devel
cd netanim-3.105
make clean

qmake-qt4 NetAnim.pro
make
./NetAnim

(IX) Classes in Ns3


Container Classes

Node Container
!!!Net Device Container
!!!Ipv4 Interface
Container !!!Application
Container

Helper Classes

!!!Point to Point
Helper !!!Internet
Stack Helper !!!Ipv4
Address Helper

Om Dwivedi 5


(X) Topology in Ns3

Om Dwivedi 6

EXPERIMENT 2

AIM: Write a Program to simulate point to point topology using Ns-3.

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"
#include "ns3/netanim-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));

Om Dwivedi 7

clientApps.Start (Seconds (2.0));
clientApps.Stop (Seconds (10.0));

Simulator::Run ();
Simulator::Destroy ();
return 0;
}

OUTPUT:

Fig 2.1 Terminal Output-1

Om Dwivedi 8

Fig 2.2 Terminal Output-2

Fig 2.3 NetAnim Graphical Simulation Output

Om Dwivedi 9

EXPERIMENT 3

AIM: Write a Program to simulate three-point topology using Ns-3.

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"
#include "ns3/netanim-module.h"

using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("FirstScriptExample");

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

CommandLine cmd;
cmd.Parse(argc, argv);

Time::SetResolution (Time::NS);
LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);

NodeContainer nodes;
nodes.Create(3);

PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer devices;
devices = pointToPoint.Install (nodes.Get(0),nodes.Get(1));

NetDeviceContainer devices1;
devices1 = pointToPoint.Install (nodes.Get(2),nodes.Get(1));

InternetStackHelper stack;
stack.Install (nodes);

Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");

Ipv4AddressHelper address1;
address1.SetBase ("10.5.1.0", "255.255.255.0");

Ipv4InterfaceContainer interfaces = address.Assign(devices);


Ipv4InterfaceContainer interfaces1 = address1.Assign(devices1);

Ipv4GlobalRoutingHelper::PopulateRoutingTables();

Om Dwivedi 10

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));

ApplicationContainer clientApps1 = echoClient.Install


(nodes.Get(2));
clientApps1.Start (Seconds(2.0));
clientApps1.Stop (Seconds(10.0));

AnimationInterface anim("threePoint.xml");
anim.SetConstantPosition(nodes.Get(0),5,10);
anim.SetConstantPosition(nodes.Get(1),10,25);
anim.SetConstantPosition(nodes.Get(2),15,25);

Simulator::Run ();
Simulator::Destroy ();
return 0;
}

OUTPUT:

Fig 3.1 Terminal Output

Om Dwivedi 11

Fig 3.2 NetAnim Graphical Simulation Output

Om Dwivedi 12

EXPERIMENT 4

AIM: Write a Program to simulate four-point topology using Ns-3.

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"
#include "ns3/netanim-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 (4);

PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));

NetDeviceContainer devices;
devices = pointToPoint.Install (nodes.Get(0),nodes.Get(1));

InternetStackHelper stack;
stack.Install (nodes);

Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer interfaces = address.Assign (devices);
PointToPointHelper pointToPoint1;
pointToPoint1.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint1.SetChannelAttribute ("Delay", StringValue ("2ms")); devices
= pointToPoint1.Install (nodes.Get(1),nodes.Get(2)); address.SetBase
("10.1.2.0", "255.255.255.0");
interfaces = address.Assign (devices);

PointToPointHelper pointToPoint2;
pointToPoint2.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint2.SetChannelAttribute ("Delay", StringValue ("2ms")); devices
= pointToPoint2.Install (nodes.Get(2),nodes.Get(3)); address.SetBase
("10.1.3.0", "255.255.255.0");
interfaces = address.Assign (devices);

Om Dwivedi 13

Ipv4GlobalRoutingHelper::PopulateRoutingTables();

UdpEchoServerHelper echoServer (9);

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


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));

AnimationInterface anim("anim33.xml");
anim.SetConstantPosition(nodes.Get(0),1,2);
anim.SetConstantPosition(nodes.Get(1),15,15);
anim.SetConstantPosition(nodes.Get(2),10,30);
anim.SetConstantPosition(nodes.Get(3),50,15);

Simulator::Run ();
Simulator::Destroy ();
return 0;
}

OUTPUT:

Fig 4.1 Terminal Output

Om Dwivedi 14

Fig 4.2 NetAnim Graphical Simulation Output

Om Dwivedi 15

EXPERIMENT 5

AIM: Write a Program to simulate five-point topology using Ns-3.

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"
#include "ns3/netanim-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 (5);

PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));

NetDeviceContainer devices;
devices = pointToPoint.Install (nodes.Get(0),nodes.Get(1));

InternetStackHelper stack;
stack.Install (nodes);

Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");

Ipv4InterfaceContainer interfaces = address.Assign (devices);


PointToPointHelper pointToPoint1;
pointToPoint1.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint1.SetChannelAttribute ("Delay", StringValue ("2ms")); devices
= pointToPoint1.Install (nodes.Get(1),nodes.Get(2)); address.SetBase
("10.1.2.0", "255.255.255.0");
interfaces = address.Assign (devices);

PointToPointHelper pointToPoint2;
pointToPoint2.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint2.SetChannelAttribute ("Delay", StringValue ("2ms")); devices
= pointToPoint2.Install (nodes.Get(2),nodes.Get(3)); address.SetBase
("10.1.3.0", "255.255.255.0");
interfaces = address.Assign (devices);

PointToPointHelper pointToPoint3;
pointToPoint3.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));

Om Dwivedi 16

pointToPoint3.SetChannelAttribute ("Delay", StringValue ("2ms"));
devices = pointToPoint3.Install (nodes.Get(3),nodes.Get(4));
address.SetBase ("10.1.4.0", "255.255.255.0");
interfaces = address.Assign (devices);

Ipv4GlobalRoutingHelper::PopulateRoutingTables();
UdpEchoServerHelper echoServer (9);
ApplicationContainer serverApps = echoServer.Install (nodes.Get (4));
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));

AnimationInterface anim("anim33.xml");
anim.SetConstantPosition(nodes.Get(0),1,2);
anim.SetConstantPosition(nodes.Get(1),15,15);
anim.SetConstantPosition(nodes.Get(2),10,30);
anim.SetConstantPosition(nodes.Get(3),50,15);
anim.SetConstantPosition(nodes.Get(4),60,0);

Simulator::Run ();
Simulator::Destroy ();
return 0;
}

OUTPUT:

Fig 5.1 Terminal Output

Om Dwivedi 17

Fig 5.2 NetAnim Graphical Simulation Output

Om Dwivedi 18

EXPERIMENT 6

AIM: Write a Program to simulate a point-to-point and LAN topology


using Ns-3.

CODE:
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/csma-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h" #include
"ns3/ipv4-global-routing-helper.h" #include
"ns3/netanim-module.h"
// Default Network
Topology //
// 10.1.1.0
// n0 -------------- n1 n2 n3 n4
// point-to-point | | | |
// ================
// LAN 10.1.2.0

using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("SecondScriptExample");

int
main (int argc, char *argv[]) {
bool verbose = true;
uint32_t nCsma = 3;

CommandLine cmd;
cmd.AddValue ("nCsma", "Number of \"extra\" CSMA nodes/devices",
nCsma);
cmd.AddValue ("verbose", "Tell echo applications to log if true",
verbose);

cmd.Parse (argc,argv);

if (verbose)
{
LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);
}

nCsma = nCsma == 0 ? 1 : nCsma;

NodeContainer p2pNodes;
p2pNodes.Create (2);

NodeContainer csmaNodes;
csmaNodes.Add (p2pNodes.Get (1));

Om Dwivedi 19




csmaNodes.Create (nCsma);

PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));

NetDeviceContainer p2pDevices;
p2pDevices = pointToPoint.Install (p2pNodes);

CsmaHelper csma;
csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps"));
csma.SetChannelAttribute ("Delay", TimeValue (NanoSeconds (6560)));

NetDeviceContainer csmaDevices;
csmaDevices = csma.Install (csmaNodes);

InternetStackHelper stack;
stack.Install (p2pNodes.Get (0));
stack.Install (csmaNodes);

Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer p2pInterfaces;
p2pInterfaces = address.Assign (p2pDevices);

address.SetBase ("10.1.2.0", "255.255.255.0");


Ipv4InterfaceContainer csmaInterfaces;
csmaInterfaces = address.Assign (csmaDevices);

UdpEchoServerHelper echoServer (9);

ApplicationContainer serverApps = echoServer.Install (csmaNodes.Get


(nCsma));
serverApps.Start (Seconds (1.0));
serverApps.Stop (Seconds (10.0));

UdpEchoClientHelper echoClient (csmaInterfaces.GetAddress (nCsma), 9);


echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));

ApplicationContainer clientApps = echoClient.Install (p2pNodes.Get


(0));
clientApps.Start (Seconds (2.0));
clientApps.Stop (Seconds (10.0));

Ipv4GlobalRoutingHelper::PopulateRoutingTables ();

pointToPoint.EnablePcapAll ("second");
csma.EnablePcap ("second", csmaDevices.Get (1), true);

AnimationInterface anim("second2.xml");
anim.SetConstantPosition(p2pNodes.Get(0),0.0,0.0);
anim.SetConstantPosition(p2pNodes.Get(1),10.0,20.0);
anim.SetConstantPosition(csmaNodes.Get(1),20.0,30.0);
anim.SetConstantPosition(csmaNodes.Get(2),30.0,40.0);
anim.SetConstantPosition(csmaNodes.Get(3),40.0,50.0);

Om Dwivedi 20

Simulator::Run ();
Simulator::Destroy ();
return 0;
}

OUTPUT:

Fig 6.1 Terminal Output

Om Dwivedi 21

Fig 6.2 NetAnim Graphical Simulation Output

Om Dwivedi 22

You might also like