<s>
The	O
Transmission	B-Protocol
Control	I-Protocol
Protocol	I-Protocol
(	O
TCP	O
)	O
is	O
one	O
of	O
the	O
main	O
protocols	O
of	O
the	O
Internet	B-Protocol
protocol	I-Protocol
suite	I-Protocol
.	O
</s>
<s>
It	O
originated	O
in	O
the	O
initial	O
network	O
implementation	O
in	O
which	O
it	O
complemented	O
the	O
Internet	B-Protocol
Protocol	I-Protocol
(	O
IP	O
)	O
.	O
</s>
<s>
Therefore	O
,	O
the	O
entire	O
suite	O
is	O
commonly	O
referred	O
to	O
as	O
TCP/IP	B-Protocol
.	O
</s>
<s>
TCP	O
provides	O
reliable	B-Protocol
,	O
ordered	O
,	O
and	O
error-checked	B-Error_Name
delivery	O
of	O
a	O
stream	O
of	O
octets	O
(	O
bytes	O
)	O
between	O
applications	O
running	O
on	O
hosts	O
communicating	O
via	O
an	O
IP	B-Protocol
network	I-Protocol
.	O
</s>
<s>
Major	O
internet	O
applications	O
such	O
as	O
the	O
World	O
Wide	O
Web	O
,	O
email	O
,	O
remote	B-Protocol
administration	I-Protocol
,	O
and	O
file	B-Protocol
transfer	I-Protocol
rely	O
on	O
TCP	O
,	O
which	O
is	O
part	O
of	O
the	O
Transport	B-Architecture
Layer	I-Architecture
of	O
the	O
TCP/IP	B-Protocol
suite	I-Protocol
.	O
</s>
<s>
SSL/TLS	B-Protocol
often	O
runs	O
on	O
top	O
of	O
TCP	O
.	O
</s>
<s>
TCP	O
is	O
connection-oriented	B-Protocol
,	O
and	O
a	O
connection	O
between	O
client	O
and	O
server	O
is	O
established	O
before	O
data	O
can	O
be	O
sent	O
.	O
</s>
<s>
Three-way	O
handshake	O
(	O
active	O
open	O
)	O
,	O
retransmission	B-Protocol
,	O
and	O
error	B-Error_Name
detection	I-Error_Name
adds	O
to	O
reliability	O
but	O
lengthens	O
latency	B-Protocol
.	O
</s>
<s>
Applications	O
that	O
do	O
not	O
require	O
reliable	B-Protocol
data	B-General_Concept
stream	I-General_Concept
service	O
may	O
use	O
the	O
User	B-Protocol
Datagram	I-Protocol
Protocol	I-Protocol
(	O
UDP	O
)	O
instead	O
,	O
which	O
provides	O
a	O
connectionless	B-Protocol
datagram	B-Protocol
service	I-Protocol
that	O
prioritizes	O
time	O
over	O
reliability	O
.	O
</s>
<s>
TCP	O
employs	O
network	B-Protocol
congestion	I-Protocol
avoidance	O
.	O
</s>
<s>
However	O
,	O
there	O
are	O
vulnerabilities	O
in	O
TCP	O
,	O
including	O
denial	O
of	O
service	O
,	O
connection	B-Protocol
hijacking	I-Protocol
,	O
TCP	O
veto	O
,	O
and	O
reset	B-Protocol
attack	I-Protocol
.	O
</s>
<s>
In	O
May	O
1974	O
,	O
Vint	O
Cerf	O
and	O
Bob	O
Kahn	O
described	O
an	O
internetworking	B-Architecture
protocol	O
for	O
sharing	O
resources	O
using	O
packet	B-Protocol
switching	I-Protocol
among	O
network	O
nodes	O
.	O
</s>
<s>
The	O
specification	O
of	O
the	O
resulting	O
protocol	O
,	O
(	O
Specification	O
of	O
Internet	O
Transmission	B-Protocol
Control	I-Protocol
Program	I-Protocol
)	O
,	O
was	O
written	O
by	O
Vint	O
Cerf	O
,	O
Yogen	O
Dalal	O
,	O
and	O
Carl	O
Sunshine	O
,	O
and	O
published	O
in	O
December	O
1974	O
.	O
</s>
<s>
It	O
contains	O
the	O
first	O
attested	O
use	O
of	O
the	O
term	O
internet	O
,	O
as	O
a	O
shorthand	O
for	O
internetwork	B-Architecture
.	O
</s>
<s>
A	O
central	O
control	O
component	O
of	O
this	O
model	O
was	O
the	O
Transmission	B-Protocol
Control	I-Protocol
Program	I-Protocol
that	O
incorporated	O
both	O
connection-oriented	B-Protocol
links	I-Protocol
and	O
datagram	B-Protocol
services	I-Protocol
between	O
hosts	O
.	O
</s>
<s>
The	O
monolithic	O
Transmission	B-Protocol
Control	I-Protocol
Program	I-Protocol
was	O
later	O
divided	O
into	O
a	O
modular	O
architecture	O
consisting	O
of	O
the	O
Transmission	B-Protocol
Control	I-Protocol
Protocol	I-Protocol
and	O
the	O
Internet	B-Protocol
Protocol	I-Protocol
.	O
</s>
<s>
This	O
resulted	O
in	O
a	O
networking	O
model	O
that	O
became	O
known	O
informally	O
as	O
TCP/IP	B-Protocol
,	O
although	O
formally	O
it	O
was	O
variously	O
referred	O
to	O
as	O
the	O
Department	O
of	O
Defense	O
(	O
DOD	O
)	O
model	O
,	O
and	O
ARPANET	O
model	O
,	O
and	O
eventually	O
also	O
as	O
the	O
Internet	B-Protocol
Protocol	I-Protocol
Suite	I-Protocol
.	O
</s>
<s>
In	O
2004	O
,	O
Vint	O
Cerf	O
and	O
Bob	O
Kahn	O
received	O
the	O
Turing	O
Award	O
for	O
their	O
foundational	O
work	O
on	O
TCP/IP	B-Protocol
.	O
</s>
<s>
The	O
Transmission	B-Protocol
Control	I-Protocol
Protocol	I-Protocol
provides	O
a	O
communication	O
service	O
at	O
an	O
intermediate	O
level	O
between	O
an	O
application	O
program	O
and	O
the	O
Internet	B-Protocol
Protocol	I-Protocol
.	O
</s>
<s>
It	O
provides	O
host-to-host	O
connectivity	O
at	O
the	O
transport	B-Architecture
layer	I-Architecture
of	O
the	O
Internet	B-Protocol
model	I-Protocol
.	O
</s>
<s>
An	O
application	O
does	O
not	O
need	O
to	O
know	O
the	O
particular	O
mechanisms	O
for	O
sending	O
data	O
via	O
a	O
link	O
to	O
another	O
host	O
,	O
such	O
as	O
the	O
required	O
IP	B-Protocol
fragmentation	I-Protocol
to	O
accommodate	O
the	O
maximum	B-Protocol
transmission	I-Protocol
unit	I-Protocol
of	O
the	O
transmission	O
medium	O
.	O
</s>
<s>
At	O
the	O
transport	B-Architecture
layer	I-Architecture
,	O
TCP	O
handles	O
all	O
handshaking	O
and	O
transmission	O
details	O
and	O
presents	O
an	O
abstraction	B-Application
of	O
the	O
network	O
connection	O
to	O
the	O
application	O
typically	O
through	O
a	O
network	B-Protocol
socket	I-Protocol
interface	O
.	O
</s>
<s>
At	O
the	O
lower	O
levels	O
of	O
the	O
protocol	B-Protocol
stack	I-Protocol
,	O
due	O
to	O
network	B-Protocol
congestion	I-Protocol
,	O
traffic	O
load	B-Application
balancing	I-Application
,	O
or	O
unpredictable	O
network	O
behaviour	O
,	O
IP	O
packets	O
may	O
be	O
lost	B-Protocol
,	O
duplicated	O
,	O
or	O
delivered	B-Protocol
out	I-Protocol
of	I-Protocol
order	I-Protocol
.	O
</s>
<s>
TCP	O
detects	O
these	O
problems	O
,	O
requests	O
re-transmission	B-Protocol
of	O
lost	B-Protocol
data	O
,	O
rearranges	O
out-of-order	O
data	O
and	O
even	O
helps	O
minimize	O
network	B-Protocol
congestion	I-Protocol
to	O
reduce	O
the	O
occurrence	O
of	O
the	O
other	O
problems	O
.	O
</s>
<s>
Thus	O
,	O
TCP	O
abstracts	B-Application
the	O
application	O
's	O
communication	O
from	O
the	O
underlying	O
networking	O
details	O
.	O
</s>
<s>
TCP	O
is	O
used	O
extensively	O
by	O
many	O
internet	O
applications	O
,	O
including	O
the	O
World	O
Wide	O
Web	O
(	O
WWW	O
)	O
,	O
email	O
,	O
File	B-Protocol
Transfer	I-Protocol
Protocol	I-Protocol
,	O
Secure	B-Protocol
Shell	I-Protocol
,	O
peer-to-peer	O
file	O
sharing	O
,	O
and	O
streaming	O
media	O
.	O
</s>
<s>
TCP	O
is	O
optimized	O
for	O
accurate	O
delivery	O
rather	O
than	O
timely	O
delivery	O
and	O
can	O
incur	O
relatively	O
long	O
delays	O
(	O
on	O
the	O
order	O
of	O
seconds	O
)	O
while	O
waiting	O
for	O
out-of-order	O
messages	O
or	O
re-transmissions	B-Protocol
of	O
lost	B-Protocol
messages	O
.	O
</s>
<s>
Therefore	O
,	O
it	O
is	O
not	O
particularly	O
suitable	O
for	O
real-time	O
applications	O
such	O
as	O
voice	B-Application
over	I-Application
IP	I-Application
.	O
</s>
<s>
For	O
such	O
applications	O
,	O
protocols	O
like	O
the	O
Real-time	B-Protocol
Transport	I-Protocol
Protocol	I-Protocol
(	O
RTP	O
)	O
operating	O
over	O
the	O
User	B-Protocol
Datagram	I-Protocol
Protocol	I-Protocol
(	O
UDP	O
)	O
are	O
usually	O
recommended	O
instead	O
.	O
</s>
<s>
TCP	O
is	O
a	O
reliable	B-Protocol
byte	O
stream	O
delivery	O
service	O
which	O
guarantees	O
that	O
all	O
bytes	O
received	O
will	O
be	O
identical	O
and	O
in	O
the	O
same	O
order	O
as	O
those	O
sent	O
.	O
</s>
<s>
Since	O
packet	O
transfer	O
by	O
many	O
networks	O
is	O
not	O
reliable	B-Protocol
,	O
TCP	O
achieves	O
this	O
using	O
a	O
technique	O
known	O
as	O
positive	O
acknowledgement	O
with	O
re-transmission	B-Protocol
.	O
</s>
<s>
The	O
timer	O
is	O
needed	O
in	O
case	O
a	O
packet	O
gets	O
lost	B-Protocol
or	O
corrupted	O
.	O
</s>
<s>
For	O
example	O
,	O
when	O
an	O
HTML	O
file	O
is	O
sent	O
from	O
a	O
web	O
server	O
,	O
the	O
TCP	O
software	O
layer	O
of	O
that	O
server	O
divides	O
the	O
file	O
into	O
segments	O
and	O
forwards	O
them	O
individually	O
to	O
the	O
internet	B-Protocol
layer	I-Protocol
in	O
the	O
network	B-Protocol
stack	I-Protocol
.	O
</s>
<s>
The	O
internet	B-Protocol
layer	I-Protocol
software	O
encapsulates	O
each	O
TCP	O
segment	O
into	O
an	O
IP	O
packet	O
by	O
adding	O
a	O
header	O
that	O
includes	O
(	O
among	O
other	O
data	O
)	O
the	O
destination	O
IP	B-Protocol
address	I-Protocol
.	O
</s>
<s>
When	O
the	O
client	O
program	O
on	O
the	O
destination	O
computer	O
receives	O
them	O
,	O
the	O
TCP	O
software	O
in	O
the	O
transport	B-Architecture
layer	I-Architecture
re-assembles	O
the	O
segments	O
and	O
ensures	O
they	O
are	O
correctly	O
ordered	O
and	O
error-free	O
as	O
it	O
streams	O
the	O
file	O
contents	O
to	O
the	O
receiving	O
application	O
.	O
</s>
<s>
Transmission	B-Protocol
Control	I-Protocol
Protocol	I-Protocol
accepts	O
data	O
from	O
a	O
data	B-General_Concept
stream	I-General_Concept
,	O
divides	O
it	O
into	O
chunks	O
,	O
and	O
adds	O
a	O
TCP	B-Protocol
header	I-Protocol
creating	O
a	O
TCP	O
segment	O
.	O
</s>
<s>
The	O
TCP	O
segment	O
is	O
then	O
encapsulated	B-Protocol
into	O
an	B-Architecture
Internet	I-Architecture
Protocol	O
(	O
IP	O
)	O
datagram	B-Protocol
,	O
and	O
exchanged	O
with	O
peers	O
.	O
</s>
<s>
The	O
term	O
TCP	O
packet	O
appears	O
in	O
both	O
informal	O
and	O
formal	O
usage	O
,	O
whereas	O
in	O
more	O
precise	O
terminology	O
segment	O
refers	O
to	O
the	O
TCP	B-Protocol
protocol	I-Protocol
data	O
unit	O
(	O
PDU	O
)	O
,	O
datagram	B-Protocol
to	O
the	O
IP	O
PDU	O
,	O
and	O
frame	O
to	O
the	O
data	B-Protocol
link	I-Protocol
layer	I-Protocol
PDU	O
:	O
</s>
<s>
The	O
length	O
of	O
the	O
data	O
section	O
is	O
not	O
specified	O
in	O
the	O
segment	O
header	O
;	O
it	O
can	O
be	O
calculated	O
by	O
subtracting	O
the	O
combined	O
length	O
of	O
the	O
segment	O
header	O
and	O
IP	O
header	O
from	O
the	O
total	O
IP	O
datagram	B-Protocol
length	O
specified	O
in	O
the	O
IP	O
header	O
.	O
</s>
<s>
+TCP	O
segment	O
header	O
Offsets	O
0	O
1	O
2	O
3	O
Octet	O
Bit	O
0	O
1	O
2	O
3	O
4	O
5	O
6	O
7	O
8	O
9	O
0	O
1	O
2	O
3	O
4	O
5	O
6	O
7	O
8	O
9	O
0	O
1	O
2	O
3	O
4	O
5	O
6	O
7	O
8	O
9	O
0	O
1	O
0	O
0	O
Source	O
port	O
Destination	O
port	O
432	O
Sequence	B-Protocol
number	I-Protocol
864	O
Acknowledgment	O
number	O
(	O
if	O
ACK	O
set	O
)	O
12	O
96	O
Data	O
offset	O
Reserved0	O
0	O
0	O
0	O
Window	O
Size	O
16128	O
Checksum	B-Algorithm
Urgent	O
pointer	O
(	O
if	O
URG	O
set	O
)	O
20160	O
Options	O
(	O
if	O
data	O
offset	O
>	O
5	O
.	O
</s>
<s>
Sequence	B-Protocol
number	I-Protocol
(	O
32	O
bits	O
)	O
Has	O
a	O
dual	O
role	O
:	O
</s>
<s>
If	O
the	O
SYN	O
flag	O
is	O
set	O
(	O
1	O
)	O
,	O
then	O
this	O
is	O
the	O
initial	O
sequence	B-Protocol
number	I-Protocol
.	O
</s>
<s>
The	O
sequence	B-Protocol
number	I-Protocol
of	O
the	O
actual	O
first	O
data	O
byte	O
and	O
the	O
acknowledged	O
number	O
in	O
the	O
corresponding	O
ACK	O
are	O
then	O
this	O
sequence	B-Protocol
number	I-Protocol
plus	O
1	O
.	O
</s>
<s>
If	O
the	O
SYN	O
flag	O
is	O
clear	O
(	O
0	O
)	O
,	O
then	O
this	O
is	O
the	O
accumulated	O
sequence	B-Protocol
number	I-Protocol
of	O
the	O
first	O
data	O
byte	O
of	O
this	O
segment	O
for	O
the	O
current	O
session	O
.	O
</s>
<s>
Acknowledgment	O
number	O
(	O
32	O
bits	O
)	O
If	O
the	O
ACK	O
flag	O
is	O
set	O
then	O
the	O
value	O
of	O
this	O
field	O
is	O
the	O
next	O
sequence	B-Protocol
number	I-Protocol
that	O
the	O
sender	O
of	O
the	O
ACK	O
is	O
expecting	O
.	O
</s>
<s>
The	O
first	O
ACK	O
sent	O
by	O
each	O
end	O
acknowledges	O
the	O
other	O
end	O
's	O
initial	O
sequence	B-Protocol
number	I-Protocol
itself	O
,	O
but	O
no	O
data	O
.	O
</s>
<s>
Data	O
offset	O
(	O
4	O
bits	O
)	O
Specifies	O
the	O
size	O
of	O
the	O
TCP	B-Protocol
header	I-Protocol
in	O
32-bit	O
words	O
.	O
</s>
<s>
This	O
serves	O
as	O
an	O
indication	O
of	O
network	B-Protocol
congestion	I-Protocol
(	O
or	O
impending	O
congestion	O
)	O
to	O
the	O
TCP	O
sender	O
.	O
</s>
<s>
All	O
packets	O
after	O
the	O
initial	O
SYN	B-Protocol
packet	I-Protocol
sent	O
by	O
the	O
client	O
should	O
have	O
this	O
flag	O
set	O
.	O
</s>
<s>
SYN	O
(	O
1	O
bit	O
)	O
:	O
Synchronize	O
sequence	B-Protocol
numbers	I-Protocol
.	O
</s>
<s>
Checksum	B-Algorithm
(	O
16	O
bits	O
)	O
The	O
16-bit	O
checksum	B-Algorithm
field	O
is	O
used	O
for	O
error-checking	O
of	O
the	O
TCP	B-Protocol
header	I-Protocol
,	O
the	O
payload	O
and	O
an	O
IP	O
pseudo-header	O
.	O
</s>
<s>
The	O
pseudo-header	O
consists	O
of	O
the	O
source	O
IP	B-Protocol
address	I-Protocol
,	O
the	O
destination	O
IP	B-Protocol
address	I-Protocol
,	O
the	O
protocol	B-Protocol
number	I-Protocol
for	O
the	O
TCP	B-Protocol
protocol	I-Protocol
(	O
6	O
)	O
and	O
the	O
length	O
of	O
the	O
TCP	B-Protocol
headers	I-Protocol
and	O
payload	O
(	O
in	O
bytes	O
)	O
.	O
</s>
<s>
Urgent	O
pointer	O
(	O
16	O
bits	O
)	O
If	O
the	O
URG	O
flag	O
is	O
set	O
,	O
then	O
this	O
16-bit	O
field	O
is	O
an	O
offset	O
from	O
the	O
sequence	B-Protocol
number	I-Protocol
indicating	O
the	O
last	O
urgent	O
data	O
byte	O
.	O
</s>
<s>
An	O
Option-Kind	O
byte	O
of	O
2	O
is	O
used	O
to	O
indicate	O
Maximum	B-Protocol
Segment	I-Protocol
Size	I-Protocol
option	O
,	O
and	O
will	O
be	O
followed	O
by	O
an	O
Option-Length	O
byte	O
specifying	O
the	O
length	O
of	O
the	O
MSS	O
field	O
.	O
</s>
<s>
PaddingThe	O
TCP	B-Protocol
header	I-Protocol
padding	O
is	O
used	O
to	O
ensure	O
that	O
the	O
TCP	B-Protocol
header	I-Protocol
ends	O
,	O
and	O
data	O
begins	O
,	O
on	O
a	O
32-bit	O
boundary	O
.	O
</s>
<s>
TCP	B-Protocol
protocol	I-Protocol
operations	O
may	O
be	O
divided	O
into	O
three	O
phases	O
.	O
</s>
<s>
A	O
TCP	O
connection	O
is	O
managed	O
by	O
an	O
operating	O
system	O
through	O
a	O
resource	O
that	O
represents	O
the	O
local	O
end-point	O
for	O
communications	O
,	O
the	O
Internet	B-Protocol
socket	I-Protocol
.	O
</s>
<s>
During	O
the	O
lifetime	O
of	O
a	O
TCP	O
connection	O
,	O
the	O
local	O
end-point	O
undergoes	O
a	O
series	O
of	O
state	B-Application
changes	O
:	O
</s>
<s>
+	O
TCP	B-Protocol
socket	I-Protocol
states	O
State	B-Application
Endpoint	O
DescriptionLISTENServerWaiting	O
for	O
a	O
connection	O
request	O
from	O
any	O
remote	O
TCP	O
end-point.SYN-SENTClientWaiting	O
for	O
a	O
matching	O
connection	O
request	O
after	O
having	O
sent	O
a	O
connection	O
request.SYN-RECEIVEDServerWaiting	O
for	O
a	O
confirming	O
connection	O
request	O
acknowledgment	O
after	O
having	O
both	O
received	O
and	O
sent	O
a	O
connection	O
request.ESTABLISHEDServer	O
and	O
clientAn	O
open	O
connection	O
,	O
data	O
received	O
can	O
be	O
delivered	O
to	O
the	O
user	O
.	O
</s>
<s>
The	O
normal	O
state	B-Application
for	O
the	O
data	O
transfer	O
phase	O
of	O
the	O
connection.FIN-WAIT-1Server	O
and	O
clientWaiting	O
for	O
a	O
connection	O
termination	O
request	O
from	O
the	O
remote	O
TCP	O
,	O
or	O
an	O
acknowledgment	O
of	O
the	O
connection	O
termination	O
request	O
previously	O
sent.FIN-WAIT-2Server	O
and	O
clientWaiting	O
for	O
a	O
connection	O
termination	O
request	O
from	O
the	O
remote	O
TCP.CLOSE-WAITServer	O
and	O
clientWaiting	O
for	O
a	O
connection	O
termination	O
request	O
from	O
the	O
local	O
user.CLOSINGServer	O
and	O
clientWaiting	O
for	O
a	O
connection	O
termination	O
request	O
acknowledgment	O
from	O
the	O
remote	O
TCP.LAST-ACKServer	O
and	O
clientWaiting	O
for	O
an	O
acknowledgment	O
of	O
the	O
connection	O
termination	O
request	O
previously	O
sent	O
to	O
the	O
remote	O
TCP	O
(	O
which	O
includes	O
an	O
acknowledgment	O
of	O
its	O
connection	O
termination	O
request	O
)	O
.TIME-WAITServer	O
or	O
clientWaiting	O
for	O
enough	O
time	O
to	O
pass	O
to	O
be	O
sure	O
that	O
all	O
remaining	O
packets	O
on	O
the	O
connection	O
have	O
expired.CLOSEDServer	O
and	O
clientNo	O
connection	O
state	B-Application
at	O
all	O
.	O
</s>
<s>
The	O
client	O
sets	O
the	O
segment	O
's	O
sequence	B-Protocol
number	I-Protocol
to	O
a	O
random	O
value	O
A	O
.	O
</s>
<s>
The	O
acknowledgment	O
number	O
is	O
set	O
to	O
one	O
more	O
than	O
the	O
received	O
sequence	B-Protocol
number	I-Protocol
i.e.	O
</s>
<s>
A+1	O
,	O
and	O
the	O
sequence	B-Protocol
number	I-Protocol
that	O
the	O
server	O
chooses	O
for	O
the	O
packet	O
is	O
another	O
random	O
number	O
,	O
B	O
.	O
</s>
<s>
The	O
sequence	B-Protocol
number	I-Protocol
is	O
set	O
to	O
the	O
received	O
acknowledgment	O
value	O
i.e.	O
</s>
<s>
A+1	O
,	O
and	O
the	O
acknowledgment	O
number	O
is	O
set	O
to	O
one	O
more	O
than	O
the	O
received	O
sequence	B-Protocol
number	I-Protocol
i.e.	O
</s>
<s>
Steps	O
1	O
and	O
2	O
establish	O
and	O
acknowledge	O
the	O
sequence	B-Protocol
number	I-Protocol
for	O
one	O
direction	O
.	O
</s>
<s>
Steps	O
2	O
and	O
3	O
establish	O
and	O
acknowledge	O
the	O
sequence	B-Protocol
number	I-Protocol
for	O
the	O
other	O
direction	O
.	O
</s>
<s>
After	O
the	O
side	O
that	O
sent	O
the	O
first	O
FIN	O
has	O
responded	O
with	O
the	O
final	O
ACK	O
,	O
it	O
waits	O
for	O
a	O
timeout	O
before	O
finally	O
closing	O
the	O
connection	O
,	O
during	O
which	O
time	O
the	O
local	O
port	O
is	O
unavailable	O
for	O
new	O
connections	O
;	O
this	O
state	B-Application
lets	O
the	O
TCP	O
client	O
resend	B-Protocol
the	O
final	O
acknowledgement	O
to	O
the	O
server	O
in	O
case	O
the	O
ACK	O
is	O
lost	B-Protocol
in	O
transit	O
.	O
</s>
<s>
After	O
the	O
timeout	O
,	O
the	O
client	O
enters	O
the	O
CLOSED	O
state	B-Application
and	O
the	O
local	O
port	O
becomes	O
available	O
for	O
new	O
connections	O
.	O
</s>
<s>
Some	O
operating	O
systems	O
,	O
such	O
as	O
Linux	B-Application
and	O
HP-UX	B-Application
,	O
implement	O
a	O
half-duplex	O
close	O
sequence	O
.	O
</s>
<s>
A	O
connection	O
can	O
be	O
in	O
a	O
half-open	B-Protocol
state	B-Application
,	O
in	O
which	O
case	O
one	O
side	O
has	O
terminated	O
the	O
connection	O
,	O
but	O
the	O
other	O
has	O
not	O
.	O
</s>
<s>
The	O
number	O
of	O
sessions	O
in	O
the	O
server	O
side	O
is	O
limited	O
only	O
by	O
memory	O
and	O
can	O
grow	O
as	O
new	O
connections	O
arrive	O
,	O
but	O
the	O
client	O
must	O
allocate	O
an	O
ephemeral	B-Protocol
port	I-Protocol
before	O
sending	O
the	O
first	O
SYN	O
to	O
the	O
server	O
.	O
</s>
<s>
This	O
port	O
remains	O
allocated	O
during	O
the	O
whole	O
conversation	O
and	O
effectively	O
limits	O
the	O
number	O
of	O
outgoing	O
connections	O
from	O
each	O
of	O
the	O
client	O
's	O
IP	B-Protocol
addresses	I-Protocol
.	O
</s>
<s>
The	O
Transmission	B-Protocol
Control	I-Protocol
Protocol	I-Protocol
differs	O
in	O
several	O
key	O
features	O
compared	O
to	O
the	O
User	B-Protocol
Datagram	I-Protocol
Protocol	I-Protocol
:	O
</s>
<s>
Flow	O
control	O
:	O
limits	O
the	O
rate	O
a	O
sender	O
transfers	O
data	O
to	O
guarantee	O
reliable	B-Protocol
delivery	I-Protocol
.	O
</s>
<s>
TCP	O
uses	O
a	O
sequence	B-Protocol
number	I-Protocol
to	O
identify	O
each	O
byte	O
of	O
data	O
.	O
</s>
<s>
The	O
sequence	B-Protocol
number	I-Protocol
identifies	O
the	O
order	O
of	O
the	O
bytes	O
sent	O
from	O
each	O
computer	O
so	O
that	O
the	O
data	O
can	O
be	O
reconstructed	O
in	O
order	O
,	O
regardless	O
of	O
any	O
out-of-order	B-Protocol
delivery	I-Protocol
that	O
may	O
occur	O
.	O
</s>
<s>
The	O
sequence	B-Protocol
number	I-Protocol
of	O
the	O
first	O
byte	O
is	O
chosen	O
by	O
the	O
transmitter	O
for	O
the	O
first	O
packet	O
,	O
which	O
is	O
flagged	O
SYN	O
.	O
</s>
<s>
This	O
number	O
can	O
be	O
arbitrary	O
,	O
and	O
should	O
,	O
in	O
fact	O
,	O
be	O
unpredictable	O
to	O
defend	O
against	O
TCP	B-Protocol
sequence	I-Protocol
prediction	I-Protocol
attacks	I-Protocol
.	O
</s>
<s>
Acknowledgements	O
(	O
ACKs	O
)	O
are	O
sent	O
with	O
a	O
sequence	B-Protocol
number	I-Protocol
by	O
the	O
receiver	O
of	O
data	O
to	O
tell	O
the	O
sender	O
that	O
data	O
has	O
been	O
received	O
to	O
the	O
specified	O
byte	O
.	O
</s>
<s>
Reliability	O
is	O
achieved	O
by	O
the	O
sender	O
detecting	O
lost	B-Protocol
data	O
and	O
retransmitting	O
it	O
.	O
</s>
<s>
Retransmission	B-Protocol
timeout	O
(	O
RTO	O
)	O
and	O
duplicate	O
cumulative	O
acknowledgements	O
(	O
DupAcks	O
)	O
.	O
</s>
<s>
When	O
a	O
TCP	O
segment	O
is	O
retransmitted	O
,	O
it	O
retains	O
the	O
same	O
sequence	B-Protocol
number	I-Protocol
as	O
the	O
original	O
delivery	O
attempt	O
.	O
</s>
<s>
This	O
conflation	O
of	O
delivery	O
and	O
logical	O
data	O
ordering	O
means	O
that	O
,	O
when	O
acknowledgement	O
is	O
received	O
after	O
a	O
retransmission	B-Protocol
,	O
the	O
sender	O
cannot	O
tell	O
whether	O
the	O
original	O
transmission	O
or	O
the	O
retransmission	B-Protocol
is	O
being	O
acknowledged	O
,	O
the	O
so-called	O
retransmission	B-Protocol
ambiguity	O
.	O
</s>
<s>
TCP	O
incurs	O
complexity	O
due	O
to	O
retransmission	B-Protocol
ambiguity	O
.	O
</s>
<s>
If	O
a	O
single	O
segment	O
(	O
say	O
segment	O
number	O
100	O
)	O
in	O
a	O
stream	O
is	O
lost	B-Protocol
,	O
then	O
the	O
receiver	O
cannot	O
acknowledge	O
packets	O
above	O
that	O
segment	O
number	O
(	O
100	O
)	O
because	O
it	O
uses	O
cumulative	O
ACKs	O
.	O
</s>
<s>
This	O
duplicate	O
acknowledgement	O
is	O
used	O
as	O
a	O
signal	O
for	O
packet	B-Protocol
loss	I-Protocol
.	O
</s>
<s>
This	O
threshold	O
has	O
been	O
demonstrated	O
to	O
avoid	O
spurious	O
retransmissions	B-Protocol
due	O
to	O
reordering	O
.	O
</s>
<s>
Retransmission	B-Protocol
ambiguity	O
can	O
cause	O
spurious	O
fast	O
retransmissions	B-Protocol
and	O
congestion	O
avoidance	O
if	O
there	O
is	O
reordering	O
beyond	O
the	O
duplicate	O
acknowledgement	O
threshold	O
.	O
</s>
<s>
The	O
segment	O
is	O
retransmitted	O
if	O
the	O
timer	O
expires	O
,	O
with	O
a	O
new	O
timeout	O
threshold	O
of	O
twice	O
the	O
previous	O
value	O
,	O
resulting	O
in	O
exponential	B-Algorithm
backoff	I-Algorithm
behavior	O
.	O
</s>
<s>
Accurate	O
RTT	O
estimates	O
are	O
important	O
for	O
loss	O
recovery	O
,	O
as	O
it	O
allows	O
a	O
sender	O
to	O
assume	O
an	O
unacknowledged	O
packet	O
to	O
be	O
lost	B-Protocol
after	O
sufficient	O
time	O
elapses	O
(	O
i.e.	O
,	O
determining	O
the	O
RTO	O
time	O
)	O
.	O
</s>
<s>
Retransmission	B-Protocol
ambiguity	O
can	O
lead	O
a	O
sender	O
's	O
estimate	O
of	O
RTT	O
to	O
be	O
imprecise	O
.	O
</s>
<s>
After	O
a	O
spurious	O
retransmission	B-Protocol
,	O
when	O
the	O
acknowledgements	O
for	O
the	O
original	O
transmissions	O
arrive	O
,	O
the	O
sender	O
may	O
believe	O
them	O
to	O
be	O
acknowledging	O
the	O
retransmission	B-Protocol
and	O
conclude	O
,	O
incorrectly	O
,	O
that	O
segments	O
sent	O
between	O
the	O
original	O
transmission	O
and	O
retransmission	B-Protocol
have	O
been	O
lost	B-Protocol
,	O
causing	O
further	O
needless	O
retransmissions	B-Protocol
to	O
the	O
extent	O
that	O
the	O
link	O
truly	O
becomes	O
congested	O
;	O
selective	O
acknowlegement	O
can	O
reduce	O
this	O
effect	O
.	O
</s>
<s>
Karn	B-Protocol
's	I-Protocol
algorithm	I-Protocol
ensures	O
that	O
a	O
good	O
RTT	O
estimate	O
will	O
be	O
producedeventuallyby	O
waiting	O
until	O
there	O
is	O
an	O
unambiguous	O
acknowledgement	O
before	O
adjusting	O
the	O
RTO	O
.	O
</s>
<s>
After	O
spurious	O
retransmissions	B-Protocol
,	O
however	O
,	O
it	O
may	O
take	O
significant	O
time	O
before	O
such	O
an	O
unambiguous	O
acknowledgement	O
arrives	O
,	O
degrading	O
performance	O
in	O
the	O
interim	O
.	O
</s>
<s>
TCP	O
timestamps	O
also	O
resolve	O
the	O
retransmission	B-Protocol
ambiguity	O
problem	O
in	O
setting	O
the	O
RTO	O
,	O
though	O
they	O
do	O
not	O
necessarily	O
improve	O
the	O
RTT	O
estimate	O
.	O
</s>
<s>
Sequence	B-Protocol
numbers	I-Protocol
allow	O
receivers	O
to	O
discard	O
duplicate	O
packets	O
and	O
properly	O
sequence	O
out-of-order	O
packets	O
.	O
</s>
<s>
Acknowledgments	O
allow	O
senders	O
to	O
determine	O
when	O
to	O
retransmit	O
lost	B-Protocol
packets	I-Protocol
.	O
</s>
<s>
To	O
assure	O
correctness	O
a	O
checksum	B-Algorithm
field	O
is	O
included	O
;	O
see	O
for	O
details	O
.	O
</s>
<s>
The	O
TCP	O
checksum	B-Algorithm
is	O
a	O
weak	O
check	O
by	O
modern	O
standards	O
and	O
is	O
normally	O
paired	O
with	O
a	O
CRC	O
integrity	O
check	O
at	O
layer	B-Protocol
2	I-Protocol
,	O
below	O
both	O
TCP	O
and	O
IP	O
,	O
such	O
as	O
is	O
used	O
in	O
PPP	B-Protocol
or	O
the	O
Ethernet	O
frame	O
.	O
</s>
<s>
However	O
,	O
introduction	O
of	O
errors	O
in	O
packets	O
between	O
CRC-protected	O
hops	O
is	O
common	O
and	O
the	O
16-bit	O
TCP	O
checksum	B-Algorithm
catches	O
most	O
of	O
these	O
.	O
</s>
<s>
The	O
persist	O
timer	O
is	O
used	O
to	O
protect	O
TCP	O
from	O
a	O
deadlock	B-Operating_System
situation	O
that	O
could	O
arise	O
if	O
a	O
subsequent	O
window	O
size	O
update	O
from	O
the	O
receiver	O
is	O
lost	B-Protocol
,	O
and	O
the	O
sender	O
cannot	O
send	O
more	O
data	O
until	O
receiving	O
a	O
new	O
window	O
size	O
update	O
from	O
the	O
receiver	O
.	O
</s>
<s>
This	O
is	O
referred	O
to	O
as	O
the	O
silly	B-Protocol
window	I-Protocol
syndrome	I-Protocol
,	O
since	O
it	O
is	O
inefficient	O
to	O
send	O
only	O
a	O
few	O
bytes	O
of	O
data	O
in	O
a	O
TCP	O
segment	O
,	O
given	O
the	O
relatively	O
large	O
overhead	O
of	O
the	O
TCP	B-Protocol
header	I-Protocol
.	O
</s>
<s>
They	O
also	O
yield	O
an	O
approximately	O
max-min	B-Algorithm
fair	I-Algorithm
allocation	O
between	O
flows	O
.	O
</s>
<s>
Modern	O
implementations	O
of	O
TCP	O
contain	O
four	O
intertwined	O
algorithms	O
:	O
slow	O
start	O
,	O
congestion	O
avoidance	O
,	O
fast	B-Protocol
retransmit	I-Protocol
,	O
and	O
fast	O
recovery	O
.	O
</s>
<s>
In	O
addition	O
,	O
senders	O
employ	O
a	O
retransmission	B-Protocol
timeout	O
(	O
RTO	O
)	O
that	O
is	O
based	O
on	O
the	O
estimated	O
round-trip	O
time	O
(	O
RTT	O
)	O
between	O
the	O
sender	O
and	O
receiver	O
,	O
as	O
well	O
as	O
the	O
variance	O
in	O
this	O
round-trip	O
time	O
.	O
</s>
<s>
For	O
example	O
,	O
senders	O
must	O
be	O
careful	O
when	O
calculating	O
RTT	O
samples	O
for	O
retransmitted	O
packets	O
;	O
typically	O
they	O
use	O
Karn	B-Protocol
's	I-Protocol
Algorithm	I-Protocol
or	O
TCP	O
timestamps	O
.	O
</s>
<s>
The	O
maximum	B-Protocol
segment	I-Protocol
size	I-Protocol
(	O
MSS	O
)	O
is	O
the	O
largest	O
amount	O
of	O
data	O
,	O
specified	O
in	O
bytes	O
,	O
that	O
TCP	O
is	O
willing	O
to	O
receive	O
in	O
a	O
single	O
segment	O
.	O
</s>
<s>
For	O
best	O
performance	O
,	O
the	O
MSS	O
should	O
be	O
set	O
small	O
enough	O
to	O
avoid	O
IP	B-Protocol
fragmentation	I-Protocol
,	O
which	O
can	O
lead	O
to	O
packet	B-Protocol
loss	I-Protocol
and	O
excessive	O
retransmissions	B-Protocol
.	O
</s>
<s>
The	O
option	O
value	O
is	O
derived	O
from	O
the	O
maximum	B-Protocol
transmission	I-Protocol
unit	I-Protocol
(	O
MTU	B-Protocol
)	O
size	O
of	O
the	O
data	B-Protocol
link	I-Protocol
layer	I-Protocol
of	O
the	O
networks	O
to	O
which	O
the	O
sender	O
and	O
receiver	O
are	O
directly	O
attached	O
.	O
</s>
<s>
TCP	O
senders	O
can	O
use	O
path	B-Protocol
MTU	I-Protocol
discovery	I-Protocol
to	O
infer	O
the	O
minimum	O
MTU	B-Protocol
along	O
the	O
network	O
path	O
between	O
the	O
sender	O
and	O
receiver	O
,	O
and	O
use	O
this	O
to	O
dynamically	O
adjust	O
the	O
MSS	O
to	O
avoid	O
IP	B-Protocol
fragmentation	I-Protocol
within	O
the	O
network	O
.	O
</s>
<s>
Relying	O
purely	O
on	O
the	O
cumulative	O
acknowledgment	O
scheme	O
employed	O
by	O
the	O
original	O
TCP	O
can	O
lead	O
to	O
inefficiencies	O
when	O
packets	O
are	O
lost	B-Protocol
.	O
</s>
<s>
For	O
example	O
,	O
suppose	O
bytes	O
with	O
sequence	B-Protocol
number	I-Protocol
1,000	O
to	O
10,999	O
are	O
sent	O
in	O
10	O
different	O
TCP	O
segments	O
of	O
equal	O
size	O
,	O
and	O
the	O
second	O
segment	O
(	O
sequence	B-Protocol
numbers	I-Protocol
2,000	O
to	O
2,999	O
)	O
is	O
lost	B-Protocol
during	O
transmission	O
.	O
</s>
<s>
In	O
a	O
pure	O
cumulative	O
acknowledgment	O
protocol	O
,	O
the	O
receiver	O
can	O
only	O
send	O
a	O
cumulative	O
ACK	O
value	O
of	O
2,000	O
(	O
the	O
sequence	B-Protocol
number	I-Protocol
immediately	O
following	O
the	O
last	O
sequence	B-Protocol
number	I-Protocol
of	O
the	O
received	O
data	O
)	O
and	O
cannot	O
say	O
that	O
it	O
received	O
bytes	O
3,000	O
to	O
10,999	O
successfully	O
.	O
</s>
<s>
Thus	O
the	O
sender	O
may	O
then	O
have	O
to	O
resend	B-Protocol
all	O
data	O
starting	O
with	O
sequence	B-Protocol
number	I-Protocol
2,000	O
.	O
</s>
<s>
To	O
alleviate	O
this	O
issue	O
TCP	O
employs	O
the	O
selective	O
acknowledgment	O
(	O
SACK	O
)	O
option	O
,	O
defined	O
in	O
1996	O
in	O
RFC	O
2018	O
,	O
which	O
allows	O
the	O
receiver	O
to	O
acknowledge	O
discontinuous	O
blocks	O
of	O
packets	O
that	O
were	O
received	O
correctly	O
,	O
in	O
addition	O
to	O
the	O
sequence	B-Protocol
number	I-Protocol
immediately	O
following	O
the	O
last	O
sequence	B-Protocol
number	I-Protocol
of	O
the	O
last	O
contiguous	O
byte	O
received	O
successively	O
,	O
as	O
in	O
the	O
basic	O
TCP	O
acknowledgment	O
.	O
</s>
<s>
The	O
acknowledgment	O
can	O
include	O
a	O
number	O
of	O
SACK	O
blocks	O
,	O
where	O
each	O
SACK	O
block	O
is	O
conveyed	O
by	O
the	O
Left	O
Edge	O
of	O
Block	O
(	O
the	O
first	O
sequence	B-Protocol
number	I-Protocol
of	O
the	O
block	O
)	O
and	O
the	O
Right	O
Edge	O
of	O
Block	O
(	O
the	O
sequence	B-Protocol
number	I-Protocol
immediately	O
following	O
the	O
last	O
sequence	B-Protocol
number	I-Protocol
of	O
the	O
block	O
)	O
,	O
with	O
a	O
Block	O
being	O
a	O
contiguous	O
range	O
that	O
the	O
receiver	O
correctly	O
received	O
.	O
</s>
<s>
In	O
the	O
example	O
above	O
,	O
the	O
receiver	O
would	O
send	O
an	O
ACK	O
segment	O
with	O
a	O
cumulative	O
ACK	O
value	O
of	O
2,000	O
and	O
a	O
SACK	O
option	O
header	O
with	O
sequence	B-Protocol
numbers	I-Protocol
3,000	O
and	O
11,000	O
.	O
</s>
<s>
The	O
sender	O
would	O
accordingly	O
retransmit	O
only	O
the	O
second	O
segment	O
with	O
sequence	B-Protocol
numbers	I-Protocol
2,000	O
to	O
2,999	O
.	O
</s>
<s>
A	O
TCP	O
sender	O
may	O
interpret	O
an	O
out-of-order	O
segment	O
delivery	O
as	O
a	O
lost	B-Protocol
segment	O
.	O
</s>
<s>
The	O
TCP	O
receiver	O
sends	O
a	O
D-ACK	O
to	O
indicate	O
that	O
no	O
segments	O
were	O
lost	B-Protocol
,	O
and	O
the	O
TCP	O
sender	O
can	O
then	O
reinstate	O
the	O
higher	O
transmission	O
rate	O
.	O
</s>
<s>
SACK	O
uses	O
a	O
TCP	B-Protocol
header	I-Protocol
option	O
(	O
see	O
for	O
details	O
)	O
.	O
</s>
<s>
The	O
use	O
of	O
SACK	O
has	O
become	O
widespread	O
—	O
all	O
popular	O
TCP	B-Protocol
stacks	I-Protocol
support	O
it	O
.	O
</s>
<s>
Selective	O
acknowledgment	O
is	O
also	O
used	O
in	O
Stream	B-Protocol
Control	I-Protocol
Transmission	I-Protocol
Protocol	I-Protocol
(	O
SCTP	B-Protocol
)	O
.	O
</s>
<s>
For	O
more	O
efficient	O
use	O
of	O
high-bandwidth	O
networks	O
,	O
a	O
larger	O
TCP	B-Protocol
window	I-Protocol
size	O
may	O
be	O
used	O
.	O
</s>
<s>
A	O
16-bit	O
TCP	B-Protocol
window	I-Protocol
size	O
field	O
controls	O
the	O
flow	O
of	O
data	O
and	O
its	O
value	O
is	O
limited	O
to	O
65,535	O
bytes	O
.	O
</s>
<s>
The	O
TCP	B-Protocol
window	I-Protocol
scale	I-Protocol
option	I-Protocol
,	O
as	O
defined	O
in	O
RFC	O
1323	O
,	O
is	O
an	O
option	O
used	O
to	O
increase	O
the	O
maximum	O
window	O
size	O
to	O
1	O
gigabyte	O
.	O
</s>
<s>
Scaling	O
up	O
to	O
these	O
larger	O
window	O
sizes	O
is	O
necessary	O
for	O
TCP	B-Protocol
tuning	I-Protocol
.	O
</s>
<s>
Both	O
sides	O
must	O
send	O
the	O
option	O
in	O
their	O
SYN	O
segments	O
to	O
enable	O
window	B-Protocol
scaling	I-Protocol
in	O
either	O
direction	O
.	O
</s>
<s>
Some	O
routers	O
and	O
packet	O
firewalls	O
rewrite	O
the	O
window	B-Protocol
scaling	I-Protocol
factor	O
during	O
a	O
transmission	O
.	O
</s>
<s>
This	O
causes	O
sending	O
and	O
receiving	O
sides	O
to	O
assume	O
different	O
TCP	B-Protocol
window	I-Protocol
sizes	O
.	O
</s>
<s>
TCP	O
timestamps	O
are	O
used	O
in	O
an	O
algorithm	O
known	O
as	O
Protection	O
Against	O
Wrapped	O
Sequence	B-Protocol
numbers	I-Protocol
,	O
or	O
PAWS	O
.	O
</s>
<s>
PAWS	O
is	O
used	O
when	O
the	O
receive	O
window	O
crosses	O
the	O
sequence	B-Protocol
number	I-Protocol
wraparound	O
boundary	O
.	O
</s>
<s>
In	O
the	O
case	O
where	O
a	O
packet	O
was	O
potentially	O
retransmitted	O
,	O
it	O
answers	O
the	O
question	O
:	O
"	O
Is	O
this	O
sequence	B-Protocol
number	I-Protocol
in	O
the	O
first	O
4GB	O
or	O
the	O
second	O
?	O
"	O
</s>
<s>
Also	O
,	O
the	O
Eifel	O
detection	O
algorithm	O
uses	O
TCP	O
timestamps	O
to	O
determine	O
if	O
retransmissions	B-Protocol
are	O
occurring	O
because	O
packets	O
are	O
lost	B-Protocol
or	O
simply	O
out	O
of	O
order	O
.	O
</s>
<s>
TCP	O
timestamps	O
are	O
enabled	O
by	O
default	O
in	O
Linux	B-Application
,	O
and	O
disabled	O
by	O
default	O
in	O
Windows	O
Server	O
2008	O
,	O
2012	O
and	O
2016	O
.	O
</s>
<s>
This	O
marks	O
the	O
transmission	O
as	O
out-of-band	B-Protocol
data	I-Protocol
(	O
OOB	O
)	O
and	O
tells	O
the	O
receiving	O
program	O
to	O
process	O
it	O
immediately	O
.	O
</s>
<s>
An	O
example	O
is	O
when	O
TCP	O
is	O
used	O
for	O
a	O
remote	B-Protocol
login	I-Protocol
session	O
where	O
the	O
user	O
can	O
send	O
a	O
keyboard	O
sequence	O
that	O
interrupts	O
or	O
aborts	O
the	O
remotely-running	O
program	O
without	O
waiting	O
for	O
the	O
program	O
to	O
finish	O
its	O
current	O
transfer	O
.	O
</s>
<s>
Where	O
it	O
is	O
available	O
,	O
it	O
is	O
prudent	O
to	O
assume	O
only	O
single	O
bytes	O
of	O
OOB	B-Protocol
data	I-Protocol
will	O
be	O
reliably	O
handled	O
.	O
</s>
<s>
Normally	O
,	O
TCP	O
waits	O
for	O
200ms	O
for	O
a	O
full	O
packet	O
of	O
data	O
to	O
send	O
(	O
Nagle	B-Protocol
's	I-Protocol
Algorithm	I-Protocol
tries	O
to	O
group	O
small	O
messages	O
into	O
a	O
single	O
packet	O
)	O
.	O
</s>
<s>
This	O
wait	O
creates	O
small	O
,	O
but	O
potentially	O
serious	O
delays	O
if	O
repeated	O
constantly	O
during	O
a	O
file	B-Protocol
transfer	I-Protocol
.	O
</s>
<s>
In	O
the	O
case	O
of	O
telnet	B-Protocol
,	O
each	O
user	O
keystroke	O
is	O
echoed	O
back	O
by	O
the	O
server	O
before	O
the	O
user	O
can	O
see	O
it	O
on	O
the	O
screen	O
.	O
</s>
<s>
Setting	O
the	O
socket	B-Protocol
option	O
TCP_NODELAY	O
overrides	O
the	O
default	O
200ms	O
send	O
delay	O
.	O
</s>
<s>
Application	O
programs	O
use	O
this	O
socket	B-Protocol
option	O
to	O
force	O
output	O
to	O
be	O
sent	O
after	O
writing	O
a	O
character	O
or	O
line	O
of	O
characters	O
.	O
</s>
<s>
The	O
RFC	O
defines	O
the	O
PSH	O
push	O
bit	O
as	O
"	O
a	O
message	O
to	O
the	O
receiving	O
TCP	B-Protocol
stack	I-Protocol
to	O
send	O
this	O
data	O
immediately	O
up	O
to	O
the	O
receiving	O
application	O
"	O
.	O
</s>
<s>
There	O
is	O
no	O
way	O
to	O
indicate	O
or	O
control	O
it	O
in	O
user	B-Operating_System
space	I-Operating_System
using	O
Berkeley	B-Protocol
sockets	I-Protocol
;	O
it	O
is	O
controlled	O
by	O
the	O
protocol	B-Protocol
stack	I-Protocol
only	O
.	O
</s>
<s>
By	O
using	O
a	O
spoofed	O
IP	B-Protocol
address	I-Protocol
and	O
repeatedly	O
sending	O
purposely	B-Protocol
assembled	I-Protocol
SYN	B-Protocol
packets	I-Protocol
,	O
followed	O
by	O
many	O
ACK	B-Protocol
packets	I-Protocol
,	O
attackers	O
can	O
cause	O
the	O
server	O
to	O
consume	O
large	O
amounts	O
of	O
resources	O
keeping	O
track	O
of	O
the	O
bogus	O
connections	O
.	O
</s>
<s>
Proposed	O
solutions	O
to	O
this	O
problem	O
include	O
SYN	B-Protocol
cookies	I-Protocol
and	O
cryptographic	O
puzzles	O
,	O
though	O
SYN	B-Protocol
cookies	I-Protocol
come	O
with	O
their	O
own	O
set	O
of	O
vulnerabilities	O
.	O
</s>
<s>
Sockstress	B-Protocol
is	O
a	O
similar	O
attack	O
,	O
that	O
might	O
be	O
mitigated	O
with	O
system	O
resource	O
management	O
.	O
</s>
<s>
To	O
do	O
so	O
,	O
the	O
attacker	O
learns	O
the	O
sequence	B-Protocol
number	I-Protocol
from	O
the	O
ongoing	O
communication	O
and	O
forges	O
a	O
false	O
segment	O
that	O
looks	O
like	O
the	O
next	O
segment	O
in	O
the	O
stream	O
.	O
</s>
<s>
When	O
the	O
receiving	O
host	O
acknowledges	O
the	O
extra	O
segment	O
to	O
the	O
other	O
side	O
of	O
the	O
connection	O
,	O
synchronization	O
is	O
lost	B-Protocol
.	O
</s>
<s>
Impersonating	O
a	O
different	O
IP	B-Protocol
address	I-Protocol
was	O
not	O
difficult	O
prior	O
to	O
RFC	O
1948	O
,	O
when	O
the	O
initial	O
sequence	B-Protocol
number	I-Protocol
was	O
easily	O
guessable	O
.	O
</s>
<s>
That	O
allowed	O
an	O
attacker	O
to	O
blindly	O
send	O
a	O
sequence	O
of	O
packets	O
that	O
the	O
receiver	O
would	O
believe	O
to	O
come	O
from	O
a	O
different	O
IP	B-Protocol
address	I-Protocol
,	O
without	O
the	O
need	O
to	O
deploy	O
ARP	O
or	O
routing	O
attacks	O
:	O
it	O
is	O
enough	O
to	O
ensure	O
that	O
the	O
legitimate	O
host	O
of	O
the	O
impersonated	O
IP	B-Protocol
address	I-Protocol
is	O
down	O
,	O
or	O
bring	O
it	O
to	O
that	O
condition	O
using	O
denial-of-service	O
attacks	O
.	O
</s>
<s>
This	O
is	O
why	O
the	O
initial	O
sequence	B-Protocol
number	I-Protocol
is	O
now	O
chosen	O
at	O
random	O
.	O
</s>
<s>
The	O
attacker	O
injects	O
a	O
malicious	O
packet	O
with	O
the	O
sequence	B-Protocol
number	I-Protocol
and	O
a	O
payload	O
size	O
of	O
the	O
next	O
expected	O
packet	O
.	O
</s>
<s>
When	O
the	O
legitimate	O
packet	O
is	O
ultimately	O
received	O
,	O
it	O
is	O
found	O
to	O
have	O
the	O
same	O
sequence	B-Protocol
number	I-Protocol
and	O
length	O
as	O
a	O
packet	O
already	O
received	O
and	O
is	O
silently	O
dropped	O
as	O
a	O
normal	O
duplicate	O
packet	O
—	O
the	O
legitimate	O
packet	O
is	O
"	O
vetoed	O
"	O
by	O
the	O
malicious	O
packet	O
.	O
</s>
<s>
Unlike	O
in	O
connection	B-Protocol
hijacking	I-Protocol
,	O
the	O
connection	O
is	O
never	O
desynchronized	O
and	O
communication	O
continues	O
as	O
normal	O
after	O
the	O
malicious	O
payload	O
is	O
accepted	O
.	O
</s>
<s>
The	O
only	O
evidence	O
to	O
the	O
receiver	O
that	O
something	O
is	O
amiss	O
is	O
a	O
single	O
duplicate	O
packet	O
,	O
a	O
normal	O
occurrence	O
in	O
an	O
IP	B-Protocol
network	I-Protocol
.	O
</s>
<s>
Another	O
vulnerability	O
is	O
the	O
TCP	B-Protocol
reset	I-Protocol
attack	I-Protocol
.	O
</s>
<s>
TCP	O
and	O
UDP	O
use	O
port	B-Protocol
numbers	I-Protocol
to	O
identify	O
sending	O
and	O
receiving	O
application	O
end-points	O
on	O
a	O
host	O
,	O
often	O
called	O
Internet	B-Protocol
sockets	I-Protocol
.	O
</s>
<s>
Each	O
side	O
of	O
a	O
TCP	O
connection	O
has	O
an	O
associated	O
16-bit	O
unsigned	O
port	B-Protocol
number	I-Protocol
(	O
0-65535	O
)	O
reserved	O
by	O
the	O
sending	O
or	O
receiving	O
application	O
.	O
</s>
<s>
Port	B-Protocol
numbers	I-Protocol
are	O
categorized	O
into	O
three	O
basic	O
categories	O
:	O
well-known	O
,	O
registered	O
,	O
and	O
dynamic/private	O
.	O
</s>
<s>
Some	O
examples	O
include	O
:	O
FTP	B-Protocol
(	O
20	O
and	O
21	O
)	O
,	O
SSH	B-Protocol
(	O
22	O
)	O
,	O
TELNET	B-Protocol
(	O
23	O
)	O
,	O
SMTP	B-Protocol
(	O
25	O
)	O
,	O
HTTP	B-Protocol
over	I-Protocol
SSL/TLS	I-Protocol
(	O
443	O
)	O
,	O
and	O
HTTP	B-Protocol
(	O
80	O
)	O
.	O
</s>
<s>
Note	O
,	O
as	O
of	O
the	O
latest	O
standard	O
,	O
HTTP/3	B-Protocol
,	O
QUIC	B-Protocol
is	O
used	O
as	O
a	O
transport	O
instead	O
of	O
TCP	O
.	O
</s>
<s>
Registered	O
ports	O
are	O
typically	O
used	O
by	O
end	O
user	O
applications	O
as	O
ephemeral	B-Protocol
source	O
ports	O
when	O
contacting	O
servers	O
,	O
but	O
they	O
can	O
also	O
identify	O
named	O
services	O
that	O
have	O
been	O
registered	O
by	O
a	O
third	O
party	O
.	O
</s>
<s>
Network	B-Protocol
Address	I-Protocol
Translation	I-Protocol
(	O
NAT	B-Protocol
)	O
,	O
typically	O
uses	O
dynamic	B-Protocol
port	I-Protocol
numbers	O
,	O
on	O
the	O
(	O
"	O
Internet-facing	O
"	O
)	O
public	O
side	O
,	O
to	O
disambiguate	B-General_Concept
the	O
flow	O
of	O
traffic	O
that	O
is	O
passing	O
between	O
a	O
public	O
network	O
and	O
a	O
private	O
subnetwork	B-Protocol
,	O
thereby	O
allowing	O
many	O
IP	B-Protocol
addresses	I-Protocol
(	O
and	O
their	O
ports	O
)	O
on	O
the	O
subnet	B-Protocol
to	O
be	O
serviced	O
by	O
a	O
single	O
public-facing	O
address	O
.	O
</s>
<s>
RFC	O
1122	O
,	O
Host	O
Requirements	O
for	O
Internet	O
Hosts	O
,	O
clarified	O
a	O
number	O
of	O
TCP	B-Protocol
protocol	I-Protocol
implementation	O
requirements	O
.	O
</s>
<s>
The	O
original	O
TCP	O
congestion	O
avoidance	O
algorithm	O
was	O
known	O
as	O
"	O
TCP	O
Tahoe	O
"	O
,	O
but	O
many	O
alternative	O
algorithms	O
have	O
since	O
been	O
proposed	O
(	O
including	O
TCP	O
Reno	O
,	O
TCP	B-Protocol
Vegas	I-Protocol
,	O
FAST	B-Protocol
TCP	I-Protocol
,	O
TCP	O
New	O
Reno	O
,	O
and	O
TCP	O
Hybla	O
)	O
.	O
</s>
<s>
Multipath	B-Protocol
TCP	I-Protocol
(	O
MPTCP	B-Protocol
)	O
is	O
an	O
ongoing	O
effort	O
within	O
the	O
IETF	O
that	O
aims	O
at	O
allowing	O
a	O
TCP	O
connection	O
to	O
use	O
multiple	O
paths	O
to	O
maximize	O
resource	O
usage	O
and	O
increase	O
redundancy	O
.	O
</s>
<s>
The	O
redundancy	O
offered	O
by	O
Multipath	B-Protocol
TCP	I-Protocol
in	O
the	O
context	O
of	O
wireless	O
networks	O
enables	O
the	O
simultaneous	O
utilization	O
of	O
different	O
networks	O
,	O
which	O
brings	O
higher	O
throughput	O
and	O
better	O
handover	O
capabilities	O
.	O
</s>
<s>
Multipath	B-Protocol
TCP	I-Protocol
also	O
brings	O
performance	O
benefits	O
in	O
datacenter	O
environments	O
.	O
</s>
<s>
The	O
reference	O
implementation	O
of	O
Multipath	B-Protocol
TCP	I-Protocol
is	O
being	O
developed	O
in	O
the	O
Linux	B-Application
kernel	B-Operating_System
.	O
</s>
<s>
tcpcrypt	B-Protocol
is	O
an	O
extension	O
proposed	O
in	O
July	O
2010	O
to	O
provide	O
transport-level	O
encryption	O
directly	O
in	O
TCP	O
itself	O
.	O
</s>
<s>
Unlike	O
TLS	B-Protocol
(	O
SSL	O
)	O
,	O
tcpcrypt	B-Protocol
itself	O
does	O
not	O
provide	O
authentication	O
,	O
but	O
provides	O
simple	O
primitives	O
down	O
to	O
the	O
application	O
to	O
do	O
that	O
.	O
</s>
<s>
,	O
the	O
first	O
tcpcrypt	B-Protocol
IETF	O
draft	O
has	O
been	O
published	O
and	O
implementations	O
exist	O
for	O
several	O
major	O
platforms	O
.	O
</s>
<s>
TCP	B-Protocol
Fast	I-Protocol
Open	I-Protocol
is	O
an	O
extension	O
to	O
speed	O
up	O
the	O
opening	O
of	O
successive	O
TCP	O
connections	O
between	O
two	O
endpoints	O
.	O
</s>
<s>
It	O
is	O
similar	O
to	O
an	O
earlier	O
proposal	O
called	O
T/TCP	B-Protocol
,	O
which	O
was	O
not	O
widely	O
adopted	O
due	O
to	O
security	O
issues	O
.	O
</s>
<s>
TCP	B-Protocol
Fast	I-Protocol
Open	I-Protocol
was	O
published	O
as	O
RFC	O
7413	O
in	O
2014	O
.	O
</s>
<s>
Proposed	O
in	O
May	O
2013	O
,	O
Proportional	O
Rate	O
Reduction	O
(	O
PRR	O
)	O
is	O
a	O
TCP	O
extension	O
developed	O
by	O
Google	B-Application
engineers	O
.	O
</s>
<s>
PRR	O
ensures	O
that	O
the	O
TCP	B-Protocol
window	I-Protocol
size	O
after	O
recovery	O
is	O
as	O
close	O
to	O
the	O
slow	O
start	O
threshold	O
as	O
possible	O
.	O
</s>
<s>
The	O
algorithm	O
is	O
designed	O
to	O
improve	O
the	O
speed	O
of	O
recovery	O
and	O
is	O
the	O
default	O
congestion	O
control	O
algorithm	O
in	O
Linux	B-Application
3.2	O
+	O
kernels	B-Operating_System
.	O
</s>
<s>
TCP	B-Protocol
Cookie	I-Protocol
Transactions	I-Protocol
(	O
TCPCT	B-Protocol
)	O
is	O
an	O
extension	O
proposed	O
in	O
December	O
2009	O
to	O
secure	O
servers	O
against	O
denial-of-service	O
attacks	O
.	O
</s>
<s>
Unlike	O
SYN	B-Protocol
cookies	I-Protocol
,	O
TCPCT	B-Protocol
does	O
not	O
conflict	O
with	O
other	O
TCP	O
extensions	O
such	O
as	O
window	B-Protocol
scaling	I-Protocol
.	O
</s>
<s>
TCPCT	B-Protocol
was	O
designed	O
due	O
to	O
necessities	O
of	O
DNSSEC	B-Protocol
,	O
where	O
servers	O
have	O
to	O
handle	O
large	O
numbers	O
of	O
short-lived	O
TCP	O
connections	O
.	O
</s>
<s>
In	O
2016	O
,	O
TCPCT	B-Protocol
was	O
deprecated	O
in	O
favor	O
of	O
TCP	B-Protocol
Fast	I-Protocol
Open	I-Protocol
.	O
</s>
<s>
One	O
way	O
to	O
overcome	O
the	O
processing	O
power	O
requirements	O
of	O
TCP	O
is	O
to	O
build	O
hardware	O
implementations	O
of	O
it	O
,	O
widely	O
known	O
as	O
TCP	B-Protocol
offload	I-Protocol
engines	I-Protocol
(	O
TOE	O
)	O
.	O
</s>
<s>
This	O
visibility	O
and	O
malleability	O
of	O
metadata	O
has	O
led	O
to	O
TCP	O
being	O
difficult	O
to	O
extenda	O
case	O
of	O
protocol	O
ossificationas	O
any	O
intermediate	O
node	O
(	O
a	O
'	O
middlebox	O
 '	O
)	O
can	O
make	O
decisions	O
based	O
on	O
that	O
metadata	O
or	O
even	O
modify	O
it	O
,	O
breaking	O
the	O
end-to-end	B-Application
principle	I-Application
.	O
</s>
<s>
Avoiding	O
extensibility	O
hazards	O
from	O
intermediaries	O
placed	O
significant	O
constraints	O
on	O
the	O
design	O
of	O
MPTCP	B-Protocol
,	O
and	O
difficulties	O
caused	O
by	O
intermediaries	O
have	O
hindered	O
the	O
deployment	O
of	O
TCP	B-Protocol
Fast	I-Protocol
Open	I-Protocol
in	O
web	B-Application
browsers	I-Application
.	O
</s>
<s>
Another	O
source	O
of	O
ossification	O
is	O
the	O
difficulty	O
of	O
modification	O
of	O
TCP	O
functions	O
at	O
the	O
endpoints	O
,	O
typically	O
in	O
the	O
operating	B-Operating_System
system	I-Operating_System
kernel	I-Operating_System
or	O
in	O
hardware	O
with	O
a	O
TCP	B-Protocol
offload	I-Protocol
engine	I-Protocol
.	O
</s>
<s>
As	O
TCP	O
provides	O
applications	O
with	O
the	O
abstraction	B-Application
of	O
a	O
reliable	B-Protocol
byte	O
stream	O
,	O
it	O
can	O
suffer	O
from	O
head-of-line	B-Protocol
blocking	I-Protocol
:	O
if	O
packets	B-Protocol
are	I-Protocol
reordered	I-Protocol
or	O
lost	B-Protocol
and	O
need	O
to	O
be	O
retransmitted	O
(	O
and	O
thus	O
arrive	O
out-of-order	O
)	O
,	O
data	O
from	O
sequentially	O
later	O
parts	O
of	O
the	O
stream	O
may	O
be	O
received	O
before	O
sequentially	O
earlier	O
parts	O
of	O
the	O
stream	O
;	O
however	O
,	O
the	O
later	O
data	O
cannot	O
typically	O
be	O
used	O
until	O
the	O
earlier	O
data	O
has	O
been	O
received	O
,	O
incurring	O
network	B-Protocol
latency	I-Protocol
.	O
</s>
<s>
If	O
multiple	O
independent	O
higher-level	O
messages	O
are	O
encapsulated	B-Protocol
and	O
multiplexed	B-Architecture
onto	O
a	O
single	O
TCP	O
connection	O
,	O
then	O
head-of-line	B-Protocol
blocking	I-Protocol
can	O
cause	O
processing	O
of	O
a	O
fully-received	O
message	O
that	O
was	O
sent	O
later	O
to	O
wait	O
for	O
delivery	O
of	O
a	O
message	O
that	O
was	O
sent	O
earlier	O
.	O
</s>
<s>
Connection	O
establishment	O
is	O
a	O
major	O
contributor	O
to	O
latency	B-Protocol
as	O
experienced	O
by	O
Web	O
users	O
.	O
</s>
<s>
TCP	O
's	O
three-way	O
handshake	O
introduces	O
one	O
RTT	O
of	O
latency	B-Protocol
during	O
connection	O
establishment	O
before	O
data	O
can	O
be	O
sent	O
.	O
</s>
<s>
Transport	B-Protocol
Layer	I-Protocol
Security	I-Protocol
(	O
TLS	B-Protocol
)	O
requires	O
a	O
handshake	O
of	O
its	O
own	O
for	O
key	O
exchange	O
at	O
connection	O
establishment	O
.	O
</s>
<s>
Because	O
of	O
the	O
layered	O
design	O
,	O
the	O
TCP	O
handshake	O
and	O
the	O
TLS	B-Protocol
handshake	O
proceed	O
serially	O
:	O
the	O
TLS	B-Protocol
handshake	O
cannot	O
begin	O
until	O
the	O
TCP	O
handshake	O
has	O
concluded	O
.	O
</s>
<s>
Two	O
RTTs	O
are	O
required	O
for	O
connection	O
establishment	O
with	O
TLS	B-Protocol
1.3	O
over	O
TCP	O
.	O
</s>
<s>
TLS	B-Protocol
1.3	O
allows	O
for	O
zero	O
RTT	O
connection	O
resumption	O
in	O
some	O
circumstances	O
,	O
but	O
,	O
when	O
layered	O
over	O
TCP	O
,	O
one	O
RTT	O
is	O
still	O
required	O
for	O
the	O
TCP	O
handshake	O
,	O
and	O
this	O
cannot	O
assist	O
the	O
initial	O
connection	O
;	O
zero	O
RTT	O
handshakes	O
also	O
present	O
cryptographic	O
challenges	O
,	O
as	O
efficient	O
,	O
replay-safe	O
and	O
forward	O
secure	O
non-interactive	O
key	O
exchange	O
is	O
an	O
open	O
research	O
topic	O
.	O
</s>
<s>
TCP	B-Protocol
Fast	I-Protocol
Open	I-Protocol
allows	O
the	O
transmission	O
of	O
data	O
in	O
the	O
initial	O
(	O
i.e	O
,	O
SYN	O
and	O
SYN-ACK	O
)	O
packets	O
,	O
removing	O
one	O
RTT	O
of	O
latency	B-Protocol
during	O
connection	O
establishment	O
.	O
</s>
<s>
However	O
,	O
TCP	B-Protocol
Fast	I-Protocol
Open	I-Protocol
has	O
been	O
difficult	O
to	O
deploy	O
due	O
to	O
protocol	B-Protocol
ossification	I-Protocol
;	O
in	O
2020	O
,	O
no	O
Web	B-Application
browsers	I-Application
used	O
it	O
by	O
default	O
.	O
</s>
<s>
However	O
,	O
TCP	O
can	O
only	O
selectively	O
acknowledge	O
a	O
maximum	O
of	O
three	O
blocks	O
of	O
sequence	B-Protocol
numbers	I-Protocol
.	O
</s>
<s>
This	O
can	O
limit	O
the	O
retransmission	B-Protocol
rate	O
and	O
hence	O
loss	O
recovery	O
or	O
cause	O
needless	O
retransmissions	B-Protocol
,	O
especially	O
in	O
high-loss	O
environments	O
.	O
</s>
<s>
Packet	B-Protocol
loss	I-Protocol
is	O
considered	O
to	O
be	O
the	O
result	O
of	O
network	B-Protocol
congestion	I-Protocol
and	O
the	O
congestion	O
window	O
size	O
is	O
reduced	O
dramatically	O
as	O
a	O
precaution	O
.	O
</s>
<s>
After	O
the	O
(	O
erroneous	O
)	O
back-off	O
of	O
the	O
congestion	O
window	O
size	O
,	O
due	O
to	O
wireless	O
packet	B-Protocol
loss	I-Protocol
,	O
there	O
may	O
be	O
a	O
congestion	O
avoidance	O
phase	O
with	O
a	O
conservative	O
decrease	O
in	O
window	O
size	O
.	O
</s>
<s>
Suggested	O
solutions	O
can	O
be	O
categorized	O
as	O
end-to-end	O
solutions	O
,	O
which	O
require	O
modifications	O
at	O
the	O
client	O
or	O
server	O
,	O
link	O
layer	O
solutions	O
,	O
such	O
as	O
Radio	B-Protocol
Link	I-Protocol
Protocol	I-Protocol
(	O
RLP	B-Protocol
)	O
in	O
cellular	O
networks	O
,	O
or	O
proxy-based	O
solutions	O
which	O
require	O
some	O
changes	O
in	O
the	O
network	O
without	O
modifying	O
end	O
nodes	O
.	O
</s>
<s>
A	O
number	O
of	O
alternative	O
congestion	O
control	O
algorithms	O
,	O
such	O
as	O
Vegas	B-Protocol
,	O
Westwood	B-Protocol
,	O
Veno	O
,	O
and	O
Santa	O
Cruz	O
,	O
have	O
been	O
proposed	O
to	O
help	O
solve	O
the	O
wireless	O
problem	O
.	O
</s>
<s>
The	O
idea	O
of	O
a	O
TCP	B-Protocol
accelerator	I-Protocol
is	O
to	O
terminate	O
TCP	O
connections	O
inside	O
the	O
network	O
processor	O
and	O
then	O
relay	O
the	O
data	O
to	O
a	O
second	O
connection	O
toward	O
the	O
end	O
system	O
.	O
</s>
<s>
The	O
data	O
packets	O
that	O
originate	O
from	O
the	O
sender	O
are	O
buffered	O
at	O
the	O
accelerator	O
node	O
,	O
which	O
is	O
responsible	O
for	O
performing	O
local	O
retransmissions	B-Protocol
in	O
the	O
event	O
of	O
packet	B-Protocol
loss	I-Protocol
.	O
</s>
<s>
A	O
packet	B-Protocol
sniffer	I-Protocol
,	O
which	O
intercepts	O
TCP	O
traffic	O
on	O
a	O
network	O
link	O
,	O
can	O
be	O
useful	O
in	O
debugging	O
networks	O
,	O
network	B-Protocol
stacks	I-Protocol
,	O
and	O
applications	O
that	O
use	O
TCP	O
by	O
showing	O
the	O
user	O
what	O
packets	O
are	O
passing	O
through	O
a	O
link	O
.	O
</s>
<s>
Some	O
networking	B-Protocol
stacks	I-Protocol
support	O
the	O
SO_DEBUG	O
socket	B-Protocol
option	O
,	O
which	O
can	O
be	O
enabled	O
on	O
the	O
socket	B-Protocol
using	O
setsockopt	O
.	O
</s>
<s>
That	O
option	O
dumps	O
all	O
the	O
packets	O
,	O
TCP	O
states	O
,	O
and	O
events	O
on	O
that	O
socket	B-Protocol
,	O
which	O
is	O
helpful	O
in	O
debugging	O
.	O
</s>
<s>
Netstat	B-Application
is	O
another	O
utility	O
that	O
can	O
be	O
used	O
for	O
debugging	O
.	O
</s>
<s>
One	O
problem	O
(	O
at	O
least	O
with	O
normal	O
implementations	O
)	O
is	O
that	O
the	O
application	O
cannot	O
access	O
the	O
packets	O
coming	O
after	O
a	O
lost	B-Protocol
packet	I-Protocol
until	O
the	O
retransmitted	O
copy	O
of	O
the	O
lost	B-Protocol
packet	I-Protocol
is	O
received	O
.	O
</s>
<s>
This	O
causes	O
problems	O
for	O
real-time	O
applications	O
such	O
as	O
streaming	O
media	O
,	O
real-time	O
multiplayer	O
games	O
and	O
voice	B-Application
over	I-Application
IP	I-Application
(	O
VoIP	B-Application
)	O
where	O
it	O
is	O
generally	O
more	O
useful	O
to	O
get	O
most	O
of	O
the	O
data	O
in	O
a	O
timely	O
fashion	O
than	O
it	O
is	O
to	O
get	O
all	O
of	O
the	O
data	O
in	O
order	O
.	O
</s>
<s>
For	O
historical	O
and	O
performance	O
reasons	O
,	O
most	O
storage	O
area	O
networks	O
(	O
SANs	O
)	O
use	O
Fibre	B-Architecture
Channel	I-Architecture
Protocol	O
(	O
FCP	O
)	O
over	O
Fibre	B-Architecture
Channel	I-Architecture
connections	O
.	O
</s>
<s>
Also	O
,	O
for	O
embedded	B-Architecture
systems	I-Architecture
,	O
network	B-Device
booting	I-Device
,	O
and	O
servers	O
that	O
serve	O
simple	O
requests	O
from	O
huge	O
numbers	O
of	O
clients	O
(	O
e.g.	O
</s>
<s>
DNS	B-Protocol
servers	O
)	O
the	O
complexity	O
of	O
TCP	O
can	O
be	O
a	O
problem	O
.	O
</s>
<s>
Finally	O
,	O
some	O
tricks	O
such	O
as	O
transmitting	O
data	O
between	O
two	O
hosts	O
that	O
are	O
both	O
behind	O
NAT	B-Protocol
(	O
using	O
STUN	B-Protocol
or	O
similar	O
systems	O
)	O
are	O
far	O
simpler	O
without	O
a	O
relatively	O
complex	O
protocol	O
like	O
TCP	O
in	O
the	O
way	O
.	O
</s>
<s>
Generally	O
,	O
where	O
TCP	O
is	O
unsuitable	O
,	O
the	O
User	B-Protocol
Datagram	I-Protocol
Protocol	I-Protocol
(	O
UDP	O
)	O
is	O
used	O
.	O
</s>
<s>
This	O
provides	O
the	O
application	O
multiplexing	B-Architecture
and	O
checksums	B-Algorithm
that	O
TCP	O
does	O
,	O
but	O
does	O
not	O
handle	O
streams	O
or	O
retransmission	B-Protocol
,	O
giving	O
the	O
application	O
developer	O
the	O
ability	O
to	O
code	O
them	O
in	O
a	O
way	O
suitable	O
for	O
the	O
situation	O
,	O
or	O
to	O
replace	O
them	O
with	O
other	O
methods	O
like	O
forward	B-Error_Name
error	I-Error_Name
correction	I-Error_Name
or	O
interpolation	O
.	O
</s>
<s>
Stream	B-Protocol
Control	I-Protocol
Transmission	I-Protocol
Protocol	I-Protocol
(	O
SCTP	B-Protocol
)	O
is	O
another	O
protocol	O
that	O
provides	O
reliable	B-Protocol
stream	O
oriented	O
services	O
similar	O
to	O
TCP	O
.	O
</s>
<s>
Venturi	B-Protocol
Transport	I-Protocol
Protocol	I-Protocol
(	O
VTP	O
)	O
is	O
a	O
patented	O
proprietary	O
protocol	O
that	O
is	O
designed	O
to	O
replace	O
TCP	O
transparently	O
to	O
overcome	O
perceived	O
inefficiencies	O
related	O
to	O
wireless	O
data	O
transport	O
.	O
</s>
<s>
UDP-based	B-Language
Data	I-Language
Transfer	I-Language
Protocol	I-Language
(	O
UDT	O
)	O
has	O
better	O
efficiency	O
and	O
fairness	O
than	O
TCP	O
in	O
networks	O
that	O
have	O
high	O
bandwidth-delay	O
product	O
.	O
</s>
<s>
Multipurpose	B-Protocol
Transaction	I-Protocol
Protocol	I-Protocol
(	O
MTP/IP	B-Protocol
)	O
is	O
patented	O
proprietary	O
software	O
that	O
is	O
designed	O
to	O
adaptively	O
achieve	O
high	O
throughput	O
and	O
transaction	O
performance	O
in	O
a	O
wide	O
variety	O
of	O
network	O
conditions	O
,	O
particularly	O
those	O
where	O
TCP	O
is	O
perceived	O
to	O
be	O
inefficient	O
.	O
</s>
<s>
When	O
TCP	O
runs	O
over	O
IPv4	B-Protocol
,	O
the	O
method	O
used	O
to	O
compute	O
the	O
checksum	B-Algorithm
is	O
defined	O
as	O
follows	O
:	O
</s>
<s>
The	O
checksum	B-Algorithm
field	O
is	O
the	O
16-bit	O
ones	O
 '	O
complement	O
of	O
the	O
ones	O
 '	O
complement	O
sum	O
of	O
all	O
16-bit	O
words	O
in	O
the	O
header	O
and	O
text	O
.	O
</s>
<s>
The	O
checksum	B-Algorithm
computation	O
needs	O
to	O
ensure	O
the	O
16-bit	O
alignment	O
of	O
the	O
data	O
being	O
summed	O
.	O
</s>
<s>
If	O
a	O
segment	O
contains	O
an	O
odd	O
number	O
of	O
header	O
and	O
text	O
octets	O
,	O
alignment	O
can	O
be	O
achieved	O
by	O
padding	O
the	O
last	O
octet	O
with	O
zeros	O
on	O
its	O
right	O
to	O
form	O
a	O
16-bit	O
word	O
for	O
checksum	B-Algorithm
purposes	O
.	O
</s>
<s>
While	O
computing	O
the	O
checksum	B-Algorithm
,	O
the	O
checksum	B-Algorithm
field	O
itself	O
is	O
replaced	O
with	O
zeros	O
.	O
</s>
<s>
The	O
sum	O
is	O
then	O
bitwise	O
complemented	O
and	O
inserted	O
as	O
the	O
checksum	B-Algorithm
field	O
.	O
</s>
<s>
A	O
pseudo-header	O
that	O
mimics	O
the	O
IPv4	B-Protocol
packet	O
header	O
used	O
in	O
the	O
checksum	B-Algorithm
computation	O
is	O
shown	O
in	O
the	O
table	O
below	O
.	O
</s>
<s>
The	O
source	O
and	O
destination	O
addresses	O
are	O
those	O
of	O
the	O
IPv4	B-Protocol
header	O
.	O
</s>
<s>
List	B-Protocol
of	I-Protocol
IP	I-Protocol
protocol	I-Protocol
numbers	I-Protocol
)	O
.	O
</s>
<s>
The	O
TCP	O
length	O
field	O
is	O
the	O
length	O
of	O
the	O
TCP	B-Protocol
header	I-Protocol
and	O
data	O
(	O
measured	O
in	O
octets	O
)	O
.	O
</s>
<s>
When	O
TCP	O
runs	O
over	O
IPv6	B-Protocol
,	O
the	O
method	O
used	O
to	O
compute	O
the	O
checksum	B-Algorithm
is	O
changed	O
:	O
</s>
<s>
Any	O
transport	O
or	O
other	O
upper-layer	O
protocol	O
that	O
includes	O
the	O
addresses	O
from	O
the	O
IP	O
header	O
in	O
its	O
checksum	B-Algorithm
computation	O
must	O
be	O
modified	O
for	O
use	O
over	O
IPv6	B-Protocol
,	O
to	O
include	O
the	O
128-bit	O
IPv6	B-Protocol
addresses	O
instead	O
of	O
32-bit	O
IPv4	B-Protocol
addresses	O
.	O
</s>
<s>
A	O
pseudo-header	O
that	O
mimics	O
the	O
IPv6	B-Protocol
header	O
for	O
computation	O
of	O
the	O
checksum	B-Algorithm
is	O
shown	O
below	O
.	O
</s>
<s>
Destination	O
address	O
:	O
the	O
final	O
destination	O
;	O
if	O
the	O
IPv6	B-Protocol
packet	O
does	O
n't	O
contain	O
a	O
Routing	O
header	O
,	O
TCP	O
uses	O
the	O
destination	O
address	O
in	O
the	O
IPv6	B-Protocol
header	O
,	O
otherwise	O
,	O
at	O
the	O
originating	O
node	O
,	O
it	O
uses	O
the	O
address	O
in	O
the	O
last	O
element	O
of	O
the	O
Routing	O
header	O
,	O
and	O
,	O
at	O
the	O
receiving	O
node	O
,	O
it	O
uses	O
the	O
destination	O
address	O
in	O
the	O
IPv6	B-Protocol
header	O
.	O
</s>
<s>
Many	O
TCP/IP	B-Protocol
software	O
stack	O
implementations	O
provide	O
options	O
to	O
use	O
hardware	O
assistance	O
to	O
automatically	O
compute	O
the	O
checksum	B-Algorithm
in	O
the	O
network	B-Protocol
adapter	I-Protocol
prior	O
to	O
transmission	O
onto	O
the	O
network	O
or	O
upon	O
reception	O
from	O
the	O
network	O
for	O
validation	O
.	O
</s>
<s>
This	O
may	O
relieve	O
the	O
OS	O
from	O
using	O
precious	O
CPU	O
cycles	O
calculating	O
the	O
checksum	B-Algorithm
.	O
</s>
<s>
This	O
feature	O
may	O
cause	O
packet	B-Protocol
analyzers	I-Protocol
that	O
are	O
unaware	O
or	O
uncertain	O
about	O
the	O
use	O
of	O
checksum	B-Algorithm
offload	O
to	O
report	O
invalid	O
checksums	B-Algorithm
in	O
outbound	O
packets	O
that	O
have	O
not	O
yet	O
reached	O
the	O
network	B-Protocol
adapter	I-Protocol
.	O
</s>
<s>
This	O
will	O
only	O
occur	O
for	O
packets	O
that	O
are	O
intercepted	O
before	O
being	O
transmitted	O
by	O
the	O
network	B-Protocol
adapter	I-Protocol
;	O
all	O
packets	O
transmitted	O
by	O
the	O
network	B-Protocol
adaptor	I-Protocol
on	O
the	O
wire	O
will	O
have	O
valid	O
checksums	B-Algorithm
.	O
</s>
<s>
This	O
issue	O
can	O
also	O
occur	O
when	O
monitoring	O
packets	O
being	O
transmitted	O
between	O
virtual	O
machines	O
on	O
the	O
same	O
host	O
,	O
where	O
a	O
virtual	O
device	O
driver	O
may	O
omit	O
the	O
checksum	B-Algorithm
calculation	O
(	O
as	O
an	O
optimization	O
)	O
,	O
knowing	O
that	O
the	O
checksum	B-Algorithm
will	O
be	O
calculated	O
later	O
by	O
the	O
VM	O
host	O
kernel	B-Operating_System
or	O
its	O
physical	O
hardware	O
.	O
</s>
