Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def go_back_n(frames, window_size):
- sent = 0
- while sent < len(frames):
- print(f"Sending Frames: {frames[sent:sent+window_size]}")
- for i in range(sent, min(sent + window_size, len(frames))):
- ack = input(f"ACK for Frame {i} (y/n): ").strip().lower()
- if ack != 'y':
- print(f"Error in Frame {i}, resending window...")
- break
- else:
- sent += window_size
- continue
- sent = i
- print("All frames sent successfully!")
- frames = input("Enter frames to send (comma-separated): ").split(',')
- window_size = int(input("Enter window size: "))
- go_back_n(frames, window_size)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement