ch12 TCP
ch12 TCP
Outline:
Transmission Control Protocol (Part I)
• Connection-Oriented • Connections, Ports,
Transport and Endpoints
• Reliable Delivery Service • Passive and Active Opens
• Providing Reliability • Window Advertisement
• Retransmission Schemes • TCP Segment Format
• Sliding Window Protocols • Maximum Segment Size
– Sliding Window Control • TCP Header Checksum
• Transmission Control • TCP Pseudo-Header
Protocol • TCP Input and Output
Connection-Oriented Transport:
Send Packet 1
Receive Packet 1
Send ACK 1
Receive ACK 1
Send Packet 2
Receive Packet 2
Send ACK 2
Receive ACK 2
Providing Reliability:
Receive Packet 1
Send ACK 1
Receive ACK 1
Cancel Timer
Retransmission Schemes:
• There are three main classes of retransmission
schemes:
– Stop and Wait protocols (previous illustration)
which are not bandwidth efficient.
– Go-Back-N protocols which retransmit all
packets that follow a single erred packet.
– Selective Retransmission protocols which only
retransmit erred packets using ACKs and
NAKs (TCP).
Sliding Window Protocols:
Receive ACK 3
Transmission Control Protocol:
• TCP defines:
– Format of the data and acknowledgments.
– Procedures for hosts to ensure reliable
transmission.
– Connection establishment and release.
– How to distinguish between multiple
destinations on a given machine.
Connections, Ports,
and Endpoints:
• Unlike UDP, TCP does not use a port number to
connect to a single object.
• TCP uses the connection in its entirety as it’s
fundamental abstraction.
Connections, Ports,
and Endpoints:
• Connections are identified by a pair of endpoints.
• Endpoints are a pair of integers (HOST, PORT),
where:
– HOST is the host’s IP address.
– PORT is the TCP protocol port on that host.
Connections, Ports,
and Endpoints:
• Ex:
– MIT (18.26.0.36, 1069) to
– Purdue (128.10.2.3, 25)
– CMU (128.2.254.139, 1184) to
– Purdue (128.10.2.3, 25)
• TCP port numbers can be shared by multiple
connections on the same machine because each
connection is identified by a pair of end points.
Passive and Active Opens:
SEQUENCE NUMBER
ACKNOWLEDGEMENT NUMBER
DATA
...
TCP Segment Format:
SEQUENCE NUMBER
ACKNOWLEDGEMENT NUMBER
DATA
...
TCP Segment Format:
• WINDOW (16-bits):
– The number of bytes the receiver is willing to
accept (remote buffer size available).
• URGENT POINTER (16-bits):
– The offset to be added with the sequence
number field to yield the sequence number of
the last byte of urgent data (i.e. interrupts or
aborts).
TCP Segment Format:
SEQUENCE NUMBER
ACKNOWLEDGEMENT NUMBER
DATA
...
TCP Segment Format:
• TCP Pseudo-Header:
– Used to verify that the TCP segment has
reached it’s correct destination (since TCP
headers only use port numbers).
• A checksum is computed over the pseudo-header,
TCP-header, and the data area before sending each
segment.
TCP Pseudo-Header:
0 8 16 31
SOURCE IP ADDRESS
DESTINATION IP ADDRESS
PADDING PROTOCOL TCP LENGTH
TCP Pseudo-Header:
application programs
Ports operating system
for TCP
segments
TCP Input
Process
TCP output application programs UDP
operating system output
Control
messages
TCP TCP
queue for datagrams
Timer Process sent to IP