<s>
Stop-and-wait	B-Error_Name
ARQ	I-Error_Name
,	O
also	O
referred	O
to	O
as	O
alternating	B-Protocol
bit	I-Protocol
protocol	I-Protocol
,	O
is	O
a	O
method	O
in	O
telecommunications	O
to	O
send	O
information	O
between	O
two	O
connected	O
devices	O
.	O
</s>
<s>
It	O
is	O
the	O
simplest	O
automatic	B-Error_Name
repeat-request	I-Error_Name
(	O
ARQ	O
)	O
mechanism	O
.	O
</s>
<s>
A	O
stop-and-wait	B-Error_Name
ARQ	I-Error_Name
sender	O
sends	O
one	O
frame	B-Protocol
at	O
a	O
time	O
;	O
it	O
is	O
a	O
special	O
case	O
of	O
the	O
general	O
sliding	O
window	O
protocol	O
with	O
transmit	O
and	O
receive	O
window	O
sizes	O
equal	O
to	O
one	O
in	O
both	O
cases	O
.	O
</s>
<s>
After	O
sending	O
each	O
frame	B-Protocol
,	O
the	O
sender	O
does	O
n't	O
send	O
any	O
further	O
frames	O
until	O
it	O
receives	O
an	O
acknowledgement	B-Protocol
(	O
ACK	B-Protocol
)	O
signal	O
.	O
</s>
<s>
After	O
receiving	O
a	O
valid	O
frame	B-Protocol
,	O
the	O
receiver	O
sends	O
an	O
ACK	B-Protocol
.	O
</s>
<s>
If	O
the	O
ACK	B-Protocol
does	O
not	O
reach	O
the	O
sender	O
before	O
a	O
certain	O
time	O
,	O
known	O
as	O
the	O
timeout	O
,	O
the	O
sender	O
sends	O
the	O
same	O
frame	B-Protocol
again	O
.	O
</s>
<s>
The	O
timeout	O
countdown	O
is	O
reset	O
after	O
each	O
frame	B-Protocol
transmission	O
.	O
</s>
<s>
Typically	O
the	O
transmitter	O
adds	O
a	O
redundancy	O
check	O
number	O
to	O
the	O
end	O
of	O
each	O
frame	B-Protocol
.	O
</s>
<s>
If	O
the	O
receiver	O
sees	O
that	O
the	O
frame	B-Protocol
is	O
good	O
,	O
it	O
sends	O
an	O
ACK	B-Protocol
.	O
</s>
<s>
If	O
the	O
receiver	O
sees	O
that	O
the	O
frame	B-Protocol
is	O
damaged	O
,	O
the	O
receiver	O
discards	O
it	O
and	O
does	O
not	O
send	O
an	O
ACK	B-Protocol
—	O
pretending	O
that	O
the	O
frame	B-Protocol
was	O
completely	O
lost	O
,	O
not	O
merely	O
damaged	O
.	O
</s>
<s>
One	O
problem	O
is	O
when	O
the	O
ACK	B-Protocol
sent	O
by	O
the	O
receiver	O
is	O
damaged	O
or	O
lost	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
the	O
sender	O
does	O
n't	O
receive	O
the	O
ACK	B-Protocol
,	O
times	O
out	O
,	O
and	O
sends	O
the	O
frame	B-Protocol
again	O
.	O
</s>
<s>
Now	O
the	O
receiver	O
has	O
two	O
copies	O
of	O
the	O
same	O
frame	B-Protocol
,	O
and	O
does	O
n't	O
know	O
if	O
the	O
second	O
one	O
is	O
a	O
duplicate	O
frame	B-Protocol
or	O
the	O
next	O
frame	B-Protocol
of	O
the	O
sequence	O
carrying	O
identical	O
DATA	O
.	O
</s>
<s>
Another	O
problem	O
is	O
when	O
the	O
transmission	O
medium	O
has	O
such	O
a	O
long	O
latency	O
that	O
the	O
sender	O
's	O
timeout	O
runs	O
out	O
before	O
the	O
frame	B-Protocol
reaches	O
the	O
receiver	O
.	O
</s>
<s>
Eventually	O
the	O
receiver	O
gets	O
two	O
copies	O
of	O
the	O
same	O
frame	B-Protocol
,	O
and	O
sends	O
an	O
ACK	B-Protocol
for	O
each	O
one	O
.	O
</s>
<s>
The	O
sender	O
,	O
waiting	O
for	O
a	O
single	O
ACK	B-Protocol
,	O
receives	O
two	O
ACKs	B-Protocol
,	O
which	O
may	O
cause	O
problems	O
if	O
it	O
assumes	O
that	O
the	O
second	O
ACK	B-Protocol
is	O
for	O
the	O
next	O
frame	B-Protocol
in	O
the	O
sequence	O
.	O
</s>
<s>
To	O
avoid	O
these	O
problems	O
,	O
the	O
most	O
common	O
solution	O
is	O
to	O
define	O
a	O
1	O
bit	O
sequence	O
number	O
in	O
the	O
header	O
of	O
the	O
frame	B-Protocol
.	O
</s>
<s>
When	O
the	O
receiver	O
sends	O
an	O
ACK	B-Protocol
,	O
it	O
includes	O
the	O
sequence	O
number	O
of	O
the	O
next	O
packet	O
it	O
expects	O
.	O
</s>
<s>
This	O
way	O
,	O
the	O
receiver	O
can	O
detect	O
duplicated	O
frames	O
by	O
checking	O
if	O
the	O
frame	B-Protocol
sequence	O
numbers	O
alternate	O
.	O
</s>
<s>
If	O
two	O
subsequent	O
frames	O
have	O
the	O
same	O
sequence	O
number	O
,	O
they	O
are	O
duplicates	O
,	O
and	O
the	O
second	O
frame	B-Protocol
is	O
discarded	O
.	O
</s>
<s>
Similarly	O
,	O
if	O
two	O
subsequent	O
ACKs	B-Protocol
reference	O
the	O
same	O
sequence	O
number	O
,	O
they	O
are	O
acknowledging	O
the	O
same	O
frame	B-Protocol
.	O
</s>
<s>
Stop-and-wait	B-Error_Name
ARQ	I-Error_Name
is	O
inefficient	O
compared	O
to	O
other	O
ARQs	O
,	O
because	O
the	O
time	O
between	O
packets	O
,	O
if	O
the	O
ACK	B-Protocol
and	O
the	O
data	O
are	O
received	O
successfully	O
,	O
is	O
twice	O
the	O
transit	O
time	O
(	O
assuming	O
the	O
turnaround	B-General_Concept
time	I-General_Concept
can	O
be	O
zero	O
)	O
.	O
</s>
<s>
To	O
solve	O
this	O
problem	O
,	O
one	O
can	O
send	O
more	O
than	O
one	O
packet	O
at	O
a	O
time	O
with	O
a	O
larger	O
sequence	O
number	O
and	O
use	O
one	O
ACK	B-Protocol
for	O
a	O
set	O
.	O
</s>
<s>
This	O
is	O
what	O
is	O
done	O
in	O
Go-Back-N	B-Error_Name
ARQ	I-Error_Name
and	O
the	O
Selective	B-Error_Name
Repeat	I-Error_Name
ARQ	I-Error_Name
.	O
</s>
