please explain me the following code for stop and wait protocol
이전 댓글 표시
clc;
clear all;
disp('SAMPLE INPUT AND OUTPUT: ');
n=input('Number of Frames: ');
frame=1;
while frame<=n
fprintf('Transmitting Frame %d\n',frame);
s=randint(1,1,15);
if s<3
fprintf('TIME OUT\n Re-');
elseif s>6
fprintf('PAK of Frame %d Received\n',frame);
frame=frame+1;
else
fprintf('NAK of Frame %d Received\n Re-',frame);
end
end
댓글 수: 1
Walter Roberson
2021년 10월 1일
No, that is not what the code does. See my description below.
답변 (1개)
Walter Roberson
2013년 11월 12일
0 개 추천
The code simply simulates receiving timeouts or PAK or NAK, choosing one of them at random.
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!