Computer Network Simulation

What is Computer Network simulation?

Computer network simulation in the sense connection of two or more computer system linked together for communication.  Networking is the practice of interfacing two or more computing devices with each other for the purpose of sharing data.  Computer networks are built with a combination of hardware and software. Download Sample source code for Computer Network simulation projects.

Types of computer network design:

There are two different types of computer networks designs are available.

  • Peer-to-peer network model.
  • Client/server model.

Common computer network topologies are:

  • Star.
  • Mesh.
  • Bus.
  • Ring.
Computer Network Simulation

Sample code for computer network simulation :
NS_LOG_INFO (“Create nodes.”);
NodeContainer nodes;
nodes.Create (2);

NS_LOG_INFO (“Create channels.”);

PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute (“DataRate”, StringValue (“500Kbps”));
pointToPoint.SetChannelAttribute (“Delay”, StringValue (“5ms”));

NetDeviceContainer devices;
devices = pointToPoint.Install (nodes);

InternetStackHelper internet;
internet.Install (nodes);
NS_LOG_INFO (“Assign IP Addresses.”);
Ipv4AddressHelper ipv4;
ipv4.SetBase (“”, “”);
Ipv4InterfaceContainer i = ipv4.Assign (devices);

NS_LOG_INFO (“Create Applications.”);

uint16_t port = 9; // well-known echo port number

BulkSendHelper source (“ns3::TcpSocketFactory”,
InetSocketAddress (i.GetAddress (1), port));
// Set the amount of data to send in bytes. Zero is unlimited.
source.SetAttribute (“MaxBytes”, UintegerValue (maxBytes));
ApplicationContainer sourceApps = source.Install (nodes.Get (0));
sourceApps.Start (Seconds (0.0));
sourceApps.Stop (Seconds (10.0));