In this laboratory programming assignment you will be writing the sending and re
ID: 3846459 • Letter: I
Question
In this laboratory programming assignment you will be writing the sending and receiv
ing transportlevel code for implementing a simple reliable data transfer protocol
There are two versions of this lab the AlternatingBitProtocol aka stopandwait
version and the GoBackN version This lab should be fun since your implementation will
dier very little from what would be required in a realworld situation
Since you probably don t have standalone machines with an OS that you can modify
your code will have to execute in a simulated hardwaresoftware environment However the
programming interface provided to your routines ie the code that would call your entities
from above and from below is very close to what is done in an actual UNIX environment
Stoppingstarting of timers are also simulated and timer interrupts will cause your timer
handling routine to be activated
Explanation / Answer
For the AlternatingBitProtocol part of the lab you are to write the procedures A output A input A timerinterrupt A init B input and B init which together will imple ment a stopandwait ie the alternating bit protocol which we referred to as rdt in the text unidirectional transfer of data from the Aside to the Bside Your protocol should use both ACK and NACK messages You should choose a very large value for the average time between messages from sender s layer so that your sender is never called while it still has an outstanding unacknowledged message it is trying to send to the receiver We would suggest you choose a value of
You should also perform a check in your sender to make sure that when A output is called there is no message currently in transit If there is you can simply ignore drop the data being passed to the A output routine
For the GoBackN protocol part of the lab you are to write the procedures A output A input A timerinterrupt A init B input and B init which together will imple ment a GoBackN unidirectional transfer of data from the Aside to the Bside with a window size of Your protocol should use both ACK and NACK messages Consult the alternatingbitprotocol version of this lab above for information about how to obtain the network emulator We would STRONGLY recommend that you rst implement the easier lab Alter nating Bit and then extend your code to implement the harder lab GoBackN However some new considerations for your GoBackN code which do not apply to the Alternating Bit protocol are
A output message where message is a structure of type message containing data to be sent to the Bside Your A output routine will now sometimes be called when there are outstanding unacknowledged messages in the medium implying that you will have to buffer multiple messages in your sender Also you ll also need buffering in your sender because of the nature of GoBackN. sometimes your sender will be called but it won t be able to send the new message because the new message falls outside of the window Rather than have you worry about buffering an arbitrary number of messages it will be OK for you to have some nite maximum number of buffers available at your sender say for messages and have your sender simply abort give up and exit should all buffers be in use at one point Note using the values given below this should never happen In the
realworld of course one would have to come up with a more elegant solution to the nite buffer problem A timer interrupt This routine will be called when A s timer expires thus generating a timer interrupt Remember that you ve only got one timer and may have many outstanding unacknowledged packets in the medium so you ll have to think a bit about how to use this single timer
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.