Transmission Control Protocol
(Part I)
LESSON 15
(October 25, 1995)
Daniel Z. Tabor Jr.
New Jersey Institute of Technology
Connection-Oriented Transport:
- Transmission Control Protocol (TCP):
- Is an independent, reliable-delivery, general purpose transport protocol used in the TCP/IP protocol suite
or for use with other delivery systems.
Reliable Delivery Service:
- Features of the interface between application programs and the TCP/IP reliable delivery service include:
- Stream Orientation - data is considered as a bitstream divided into bytes.
- Buffered Transfer - transport mechanisms buffer application data until it can fill a reasonably large
datagram, using PUSH for immediate transfer.
- Virtual Circuit Connection - applications view the delivery service as a dedicated hardware circuit.
- Unstructured Stream - applications must understand the streams content.
- Full-Duplex Connection - simultaneous transmission in both directions; without simultaneous connection
release (half-duplex).
Providing Reliability:
- Sending positive acknowledgments (ACKs) with retransmission is a fundamental technique used to provide
reliable transfer.
- A timer is started during each transmission and if it expires, the message is then retransmitted.
- A combination of several timers are all used to provide a reliable delivery system.
- To avoid confusion over delayed or duplicate ACKs, positive ACK protocols use sequence numbers with
ACK messages to correctly associate acknowledgments with packets.
- These sequence numbers can be unique at each side, and are established at connection setup time.
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:
- Sliding Window Protocols:
- Used in TCP to make the transmission stream efficient
- Keep track of many acknowledged and un-acknowledged packets, instead of one at a time.
- Sliding window protocols:
- Use network bandwidth better because they allow the sender to transmit multiple packets before waiting on
each ACK.
- Transmit all packets in the window and slide it forward for each ACK received.
- Unacknowledged packets are constrained by the windows size (limited to a small fixed number).
- Sliding window performance depends upon the window size and speed the destination processes the packets.
- Well tuned sliding window protocols keep the network saturated with packets (zero idle time).
Transmission Control Protocol:
- Transmission Control Protocol - defines the reliable stream service of the TCP/IP protocol suite.
- TCP is a protocol, not a piece of software! An implementation of TCP is not the standard.
- 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 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.
- 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:
- Passive Open - function performed by an application program to inform the operating system it can accept
connections.
- Active Open - function performed by an application program to inform the operating system it want to initiate a
connection.
- A segment is TCP’s unit of transfer.
- Ideally, each segment travels in a single IP datagram.
- TCP uses a special sliding window to ensure efficient transmission and handle flow control.
- It operates at the octet level, using three pointers for every connection.
- A window for data being sent and data being received exists at each end.
- Four windows exist in total for each connection.
- TCP allows the window size to vary over time.
Window Advertisement:
- Window Advertisement - included with each ACK, specifies the number of additional octets the receiver
can accept and is prepared to do so.
- TCP uses the window advertisement feature to handle end-to-end flow control, but it cannot explicitly
solve a congestion problem.
TCP Segment Format:
- SOURCE PORT (16-bits):
- Identify source application end-points.
- DESTINATION PORTS (16-bits):
- Identify destination application end-points.
- SEQUENCE NUMBER (32-bits):
- Order in the data stream of the first byte in the data field.
- RESERVED (6-bits):
- ACKNOWLEDGEMENT NUMBER (32-bits):
- Specifies which octet the sender expects to receive next.
- HLEN (4-bits):
- The length of segment header in 32-bit words.
- CODE BITS (6-bits):
- Determines how to interpret the other header fields.
- Code-Bit Bit Position:
- URG - Urgent pointer field is valid.
- ACK - Acknowledgement field is valid.
- PSH - This segment requests a push action.
- RST - Reset the connection.
- SYN - Synchronize sequence numbers.
- FIN - Sender has reached the end of it’s byte stream.
- 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).
- This accommodates out-of-band signaling.
- TCP goes into "urgent mode" when important data arrives regardless of it’s position in the octet stream.
- The URG code bit must be set to utilized the urgent pointer and out-of-band signaling.
- OPTIONS (variable length):
- Each option field begins with an 8-bit (1 byte) field KIND that specifies the option type.
- PADDING (variable length):
- Header area used to compensate for variable length option fields.
- DATA (variable length):
- Data passed from application layer protocols.
Maximum Segment Size:
- Maximum Segment Size (MSS):
- Option is used to allow computers to limit the segment sizes appropriate to the size of their available buffer
space.
- It is important to select a MSS that will fill packets, making good use of available bandwidth.
- Standard MSS = 536
- IP datagram standard = 576
- This allows 20 bytes for the IP header and the TCP header.
Optimum Segment Size:
- Optimum segment size is difficult to find because:
- TCP doesn’t include a mechanism for doing so.
- Gateways dynamically change routes which usually have different MTU sizes.
- Size depends on lower-level protocol headers and must be reduced accordingly.
TCP Header Checksum:
- Checksum - like UDP, TCP also uses a pseudo-header when computing the checksum, verifying data and the TCP
header integrity.
- The checksum algorithm uses a 16-bit arithmetic and takes the one’s complement of the one’s complement sum.
- When IP receives a datagram destined for TCP:
- It must pass to it the source and destination IP addresses, so TCP can recompute the checksum
(pseudo-header fields).
- This scenario also violates our layered abstraction concept and the independent functionality of each layer.
TCP Pseudo-Header:
- 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.
- The twelve octets of the pseudo-header include the fields:
- Source IP address (4-octets).
- Destination IP address (4-octets).
- Padding field filled with zeros (1-octet).
- Protocol Type (1-octet), TCP = 6.
- TCP Length (2-octets)
- Length of the TCP segment without the pseudo-header.
- These values are extracted from the IP datagram header, then the checksum is recomputed
(using this pseudo-header).
- TCP as well as UDP violates the protocol boundary between it and the IP (Internet) Layer.
TCP Input and Output:
- TCP has complex input and output modules since it is connection-oriented.
- TCP, similar to UDP, has separate modules to handle the processing required for each I/O operation, as
well as input and output queues.
- There are two output sub-modules, TCP Process and TCP Timer, which communicate using control
messages and provide a reliable communication service.
All work was written, produced, and is copyrighted by Daniel Z. Tabor Jr.
Page created by Daniel Z. Tabor Jr.
Copyright ©1995 Illusion Industries Inc.