"""Go-Back-N. Your group writes Sender.send(); the receiver is given. Read stopwait.py first. Go-Back-N keeps up to `window` packets in flight instead of one, with a single timer for the oldest packet not yet ACKed. ACKs are cumulative, exactly as in stop-and-wait: ACK n means the receiver has every packet before n. That is why stopwait.Receiver already works as the Go-Back-N receiver, with no changes (P&D 2.5.2 explains why). """ import socket import time import packet import stopwait Receiver = stopwait.Receiver class Sender(stopwait.Sender): def __init__(self, sock, peer, window=8, timeout=0.1, max_fin_tries=20): super().__init__(sock, peer, window, timeout, max_fin_tries) self.window = window def send(self, data): """Deliver `data` reliably with a window of self.window, then close. YOUR TASK. Keep sending while fewer than self.window packets are unACKed. When an ACK moves the start of the window, restart the timer if anything is still in flight. When the timer runs out, send every unACKed packet again. Count transmissions and retransmissions in self.stats the way stop-and-wait does; experiments.py reports them. Finish with self._close(number of data packets), as stop-and-wait does. """ raise NotImplementedError("gbn.Sender.send")