1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| graph TD A[Open File] --> B{File Empty?} B -- No --> C[Read Data from File] C --> D{Window Not Full?} D -- Yes --> E[Send Data] E --> F{Data Sent Successfully?} F -- Yes --> G[Start Timer] F -- No --> H{Wait and Retry?} H -- Yes --> D H -- No --> J[Receive Acknowledgment] J -- Updated Window --> K{End of File?} K -- Yes --> L[Stop Sending] K -- No --> D B -- Yes --> L J -- Lost Acknowledgment --> M{Resend Data} M -- Data Resent --> F J -- Data Received --> N[Write Data to File] N --> O{Window Not Empty?} O -- Yes --> P[Update Base] O -- No --> Q{Continue Receiving?} Q -- Yes --> J Q -- No --> R[Stop Sending and Receiving]
|