Design a third protocol which has the receiver ACK each packet one by one, as the packet is delivered to the network layer. In this way, the sender can transmit packets as buffer space becomes available at the receiver. A Flush protocol . Implement this protocol over the efficiency protocol above. A flush protocol works as follows.
Flush messages are useful is certain distributed system applications.
As you might expect, this function should collect packets from the receiver's physical layer, keep track of all correctly received packets, send acknowledgments when needed, and pass the packets to the receiver's network layer when appropriate. Feel free to split your two functions into two groups of functions. That is, you may apply whatever software engineering principles or programming styles you desire. Similarly there are places for your global type definitions, global variables and functions. The contents, actually, are not important from the point of view of the datalink layer.