File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Selective Repeat Protocol Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ /* *
2+ * This code snippet in main.cpp essentially orchestrates the transmission and acknowledgment
3+ * of frames using the Selective Repeat protocol by interacting with the classes Frame and SelectiveRepeat.
4+ **/
5+
6+
7+
8+ #include < iostream>
9+ #include " Frame.h"
10+ #include " SelectiveRepeat.h"
11+ #include < vector>
12+ using namespace std ;
13+
14+
15+ int main () {
16+ int n;
17+ cout << " **************************************************************" ;
18+ cout << " ---> Enter the number of frames: " ;
19+ cin >> n;
20+ vector<Frame> frames;
21+ for (int i = 0 ; i < n; i++) {
22+ int seqNum = i;
23+ string data;
24+ cout << " ---> Enter data for frame " << seqNum << " : " ;
25+ cin >> data;
26+ frames.emplace_back (Frame (seqNum, data));
27+ }
28+ int windowSize;
29+ cout << " ---> Enter the window size: " ;
30+ cin >> windowSize;
31+ SelectiveRepeat::execute (frames, windowSize);
32+ return 0 ;
33+ cout << " **************************************************************" ;s
34+ }
You can’t perform that action at this time.
0 commit comments