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.

The language being used is C

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!