AIM: Implementation of Stop and Wait Protocol
Sender:
Step1: sequence ß 0
Step2: Accept new packet and assign sequence to it.
Step3: Send packet sequence with sequence number sequence.
Step4: Set timer for recently sent packets.
Step5: If error free acknowledgment from receiver and NextFrameExpected -> sequence then sequence -> NextFrameExpected.
Step6: If time out then go to step3.
Step7: Stop.
Receiver:
Step1: Start.
Step2: NextFrameExpected <- 0, repeat steps 3 forever.
Step3: If error-free frame received and sequence= NextFrameExpected, then pass packet to higher layer and NextFrameExpected <- NextFrameExpected+1(modulo 2).
Step4: Stop.