For this task, using the cnet network simulator:
- Add piggybacking to the standard stop-and-wait protocol.
- Modify the topology file,
changing the attributes of message delivery, bandwidth,
frame corruption and loss,
to determine under which conditions piggybacking offers an advantage.
We need to make a small number of modifications to the stop-and-wait protocol
to construct our piggyback protocol:
- Every frame carries two sequence numbers -
one identifying any data in the frame (in the payload),
and one identifying any acknowledgment in the frame.
As in the stop-and-wait protocol,
the sequence numbers can only meaningfully alternate between 0 or 1,
so we can use an 'impossible' value, such as -1,
to indicate if the frame does not carry either data or an acknowledgment
(it must be carrying one of them).
- We now require two timers - the original to retransmit a data frame if its
acknowledgment does not return in time,
and a second to transmit an acknowledgment by itself if there is
no outgoing data on which to piggyback it.
- When a frame arrives at the Physical Layer,
we must process the data it (may be) carrying
process the acknowledgment it (may be) carrying.
If the frame contains only data,
we do not send corresponding acknowledgment immediately,
but start our second timer to possibly send the acknowledgment by itself
in the future.
To perform a valid scientific experiment
(which, after all, is what we're doing),
we need to hold all conditions/arrtibutes constant and vary just one over time,
perform the same experiment for both the stop-and-wait and
As in Labsheet 2,
develop a plot to help you to visually compare the results of your experiment.
It is important compare the stop-and-wait and piggyback protocols under the
An easy way to manage this is to write the common attributes into a single
file, and then have the STOPANDWAIT and PIGGYBACK topology include
this common information
(cnet topology files are first passed through the C pre-processor).
// TOPOLOGY FILE FOR A SIMPLE DATA-LINK LAYER PROTOCOL EMPLOYING PIGGYBACKING
compile = "piggyback.c"
Remember why we are considering piggybacking - to reduce the number of
frames crossing the Physical Layer and, thus, to reduce the number of
hardware interrupts managed by each node's operating system.
Because the piggyback protocol introduces an artificial delay,
waiting for an outgoing data-frame to carry each acknowledgment,
the rate of progress of the protocol is necessarily slower
and will transmit fewer Application Layer messages.
[sample solution, containing C source and topology files: