Saturday, June 25, 2011

Stop and Wait Protocol [Matlab]


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

No comments:

Google : The top most search engine

Google : MAGIC BOX

nRelate - Posts and Homepage

LinkWithin

Related Posts Plugin for WordPress, Blogger...

Which is the toughest subject ?