Advertisement
prabhavms

stopandwait

Nov 19th, 2024
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. def stop_and_wait(frames):
  2.     for i, frame in enumerate(frames):
  3.         print(f"Sending Frame {i}: {frame}")
  4.         ack = input(f"ACK for Frame {i} received? (y/n): ").strip().lower()
  5.         while ack != 'y':
  6.             print(f"Resending Frame {i}: {frame}")
  7.             ack = input(f"ACK for Frame {i} received? (y/n): ").strip().lower()
  8.     print("All frames sent successfully!")
  9.  
  10. frames = input("Enter frames to send (comma-separated): ").split(',')
  11. stop_and_wait(frames)
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement