The Go-Back-N Protocol is a data link layer sliding window protocol. In this protocol, the sender sends frames of information over a network. These frames reside within a sending “window”, which both allows the sender to send multiple frames, and thus utilize more of the connection, and prevents the sender from sending too many frames until the receiver acknowledges receipt of some frames. If an undamaged frame is received in sequence by the receiver, the receiver sends a Receiver Ready (RR) frame back to the sender. This frame tells the sender the next packet that it is expecting, cumulatively acknowledging the successful receipt of all previous frames. When this acknowledgement is received by the sender, the right side of the sending window “slides” to allow more frames to be sent. If, instead, the receiver receives a frame out of order, it sends a Reject (REJ) frame that tells the sender which frame it was expecting. The sender then resends the expected frame. If the sender receives no RR or REJ frames after a timeout period, it may send a frame with the “Poll” bit set, which will cause the receiver to reply with the “Final” bit set and the sequence number of the frame it is expecting. For a more detailed description of Go-Back-N, consult a textbook on computer networks, such as the detailed Data and Computer Communications by William Stallings.
A color-coded key is included in the program to allow easy identification of the frame types. Select “Send Packet” to send data to the receiver. When a frame is in transit, selecting it will change its state from “good” to “damaged/lost”. Mousing over a frame will cause it to pause. Selecting “pause” or “resume” will pause/resume the entire simulation. The window size is hard-coded to 5 for this simulation. The window slides to the right during simulation and its right edge is represented by a black vertical bar.
If a frame arrives at the receiver without errors in the expected sequence order, “OK!” is displayed and a green data frame remains at the receiver. If an error-free RR is received by the sender, “OK!” is displayed for that frame and all previous frames and a blue “ACK Received” frame remains at the sender. If there were errors, the appropriate packet response is sent. To simulate a poll bit set to 1, create a damaged RR or REJ packet without sending any additional packets. If the sender receives this damaged/lost frame and no additional frames, it times out and the next packet you send will Poll the receiver for the correct sequence number.
Note that this Go-Back-N simulation is not perfect. There are a couple bugs, I didn’t have time to add a reset button, and it was not designed to run on mobile devices. I decided to upload it anyway, as I feel it does a decent job of showing Go-Back-N in action. I always appreciate a nice visual example when learning new things, and I’m sure I’m not the only one. I created this simulator for a class a couple of years ago during a quarter in which I was working 20 hours a week and taking 16 units. I wrote this simulation in Action Script 3, which I had to teach myself during this same quarter as there was no instruction in how to use it. We were able to use any language we wanted, and I chose to use Action Script 3 (for Flash) since it seemed to match well with the visual and interactive requirements. If I had to do it again, perhaps I’d use a different language, since Flash is going the way of the dinosaur, at least in the ever-expanding mobile browsing arena. Then again maybe not, since Flash tools are still nice to use when creating simple 2D vector graphics animation.