Question
In this lab you will take a first step towards writing a network simulator. Your program should start by creating two nodes. Nodes should be
In this lab you will take a first step towards writing a network simulator.
Your program should start by creating two nodes. Nodes should be implemented by a node struct that you will create. Include in the node struct all the information (variables) you consider necessary.
The protocol simulated is a very simple one.
It should run for 100 rounds. The first round is round #1.
During each round, each one of the nodes decides if it will create a packet for the other based on the following rule:
Node #1 will produce a packet in every round that is a multiple of 3.
Node #2 will produce a packet in every round that is a multiple of 4.
In each round the program checks to see which node created a packet for the other.
Each nodes must keep track of the number of packets that it created and of the number of packets it received.
At the end of the rounds, the program must print out how many packets it produced and how many packets it received.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started