TCP

TCP/IP Original Model

TCP/IP Updated Model

Application

Application

Transport
Internet

Transport
Network
Data Link
Physical

Link

Maximum and Minimum Frame Size
Frame Type

IPG
Preamble

Standard

12 Bytes

8 Bytes

Layer 1
Start of Frame
Delimiter
1 Byte

Layer2
Layer2 Frame Size with
802.1 Q
64 - 1522 Bytes

Layer2 Frame Size Without
802.1 Q
64 - 1518 Bytes

Layer4
Layer4 TCP Segment
Size
Variable

Layer4 TCP OverHead
TCP Header
20 - 60 Bytes

Layer4 UDP Segment Size
Variable

Layer4 UDP OverHead
UDP Header
8 Bytes

Layer4 TCP Segment PDU Structure

Layer4 TCP Segment
Size
Variable

Layer4 OverHead
Layer4 TCP OverHead
TCP Header
20 - 60 Bytes

Layer4 Payload
Payload
Variable

What is TCP?

Transport Control Protocol (TCP) is a Transport Layer Connection Oriented Protocol that is used for services that require ordered data transfer and data segmentation, error recovery, f
How does TCP work?

Connection Oriented Protocol? 3-Way Handshake Procedure? TCP is a connection oriented protocol. If the Connection Termination cannot be realised immediately an intermediary TCP Segment with the Ack Bit Set can be sent before the reply with Ack/Fin. The Multiplexing over ports feature. The process to create the connection is called 3-Way HandShake. Sequence No. offers connection establishment and termination capacity through the use of port initialization. permits continous streaming of bytes from an upper-layer process that is "segmented" for transmission and delivered to upper-laye Error recovery feature. as of such. sequencing and acknowledgement fields. thus. called segment. 49152 to 65535 are dynamic or private ports that cannot Ordered data transfer and data segmentation feature. offers numberig and acknowledging of data with sequence and acknowledgement header fields. Destination Port: 00:00 to FF:FF (TCP Destination Port Value).: 00:00:00:00 to FF:FF:FF:FF (TCP Sequence No. 1 is Set (TCP Acknowledgement Bit). 1 is Set (TCP Synchronization Bit). Flow control feature. Ack/Fin.TCP encapsulates the Layer5 PDU. Layer4 TCP Header Structure? 0 7 8 15 16 Source Port Window Size 23 24 31 32 39 Layer4 OverHead Layer4 TCP Header Destination Port Acknowledgement Number Checksum Offset & Reserved Urgent Pointer 40 47 Sequence Number TCP Flags Options and Padding (0 to 4 Source Port: 00:00 to FF:FF (TCP Source Port Value). Syn/Ack. bit 7 Acknowledgement: 0 is Not Set. bit 10 Syn: 0 is Not Set. Acknowledgment No. Window Size: 00:00:00:00 to FF:FF:FF:FF (TCP Window Size Value). Flag.: 00:00:00:00 to FF:FF:FF:FF (TCP Acknowledgement No. Flag. Flag. offers the use of window sizes to protect buffer space and routing devices from being overloaded with traffic. . 1 is Set (TCP Finished Bit). Ack Bits Set between the 2 communication end points. offers the posibilities to provide multiple services to run over different ports at the same time with a port number ranging between 0 and 65535. O 1024 to 49151 are register available ports (ports that become assigned to an application once a requirement is made to IANA). adding a Layer4 UDP header to it. Connection management feature. bit 11 Fin: 0 is Not Set. Value). a connection must first be established between the 2 communication endpoints before the actual data transfer can begin. A Connection Termination consists in exchanging 3 TCP Segments with the Ack/Fin. 3-Way Handshake consists in exchanging 3 TCP Segments with the Syn. turning it into a Layer4 PDU. Ack Bits Set between the 2 communication end points. offers the posibilities to The Multiplexing over ports feature. Value).

and a receiver can acknowledge the receipt of all the segments in a window with a sing In some cases. meaning that the window size is reduced to one segment. Ack=1 Seq=461. This exponential increase in window size continues until the receiver does not acknowledge successful receipt of all segments within a certain time period (known as the round . Ack=1449 * He confirms receiving 1448 Bytes. Ack Syn=0. MSS only refe If a single TCP flow drops a packet.3-Way HandShake Establishment Procedure EndPoint1 Syn=0 EndPoint2 |----------------------------------------> <----------------------------------------| Ack=1. Seq=1 Connection Maintenance |----------------------------------------> EndPoint1 Seq=1. The window size then grows exponentially until it reaches one-half of its congestion window size (that is. all TCP flows can simultaneously start to drop packets. If the transmission is consistent and no unreceived bits have been resent. This condition. while other packets go out of another interface. TCP can help prevent out-of-order packets by either sequencing th Well-Known TCP Ports? . because of all TCP flows having reduced window sizes and theref What is Out-of-Order Delivery? In many routed environments. If there is a successful acknowledgment of that one segment (that is. * The connection is estabished with a certain window size. that flow might experience TCP slow start . results in a very inefficient use of bandwidth.trip ti What is the TCP Maximum Segment Size? The TCP Maximum Segment Size (MSS) is the amount of data that can be contained in a single TCP segment. The value is dependent on the current TCP window size. Fortunately. a router has more than one egress interface that can reach a destination IP address. Upon successful receipt of those two segments. the next window contains four segments. there is a chance that the packets will arrive out of order. where the window size begins with one segment. some packets in a traffic flow might go out one interface. the receiver sends an the window size doubles to two segments. called global synchronization or TCP synchronization . the window size when congestion was previously experienced). At that point If a router interface’s output queue fills to capacity. With traffic flowing out of multiple interfaces. TCP uses a sliding window. causing all TCP flows to experience slow start. If load balancing is enabled in such a scenario. meaning that one or more segments are sent at one time. then the original window transmission s What is the TCP Sliding Window? TCP communication uses windowing.

Telnet SMTP DNS HTTP POP3 SSL 1024+ 23 25 53 80 110 443 1024+ 1024+ . Destination Port No.Application Type Source Port No.

60 Bytes Layer3 Layer3 IPv6 Packet Size 0 .Payload Size)/ Segment Size Protocol Efficiency= Payload Size/ Segment Size Throughput= Efficiency * Net Bit Rate Layer2 Layer2 MAC OverHead Frame Header 14 bytes / 18 Bytes Layer4 UDP OverHead UDP Header 8 Bytes Layer2 Payload Payload 42/46 . Layer3 IPv4 OverHead IPv4 Header 20 .1500 Bytes .1500 Bytes Layer4 Payload Payload Variable er and data segmentation. error recovery.1500 Bytes Layer2 MAC OverHead Frame Trailer 4 Bytes Layer3 IPv4 Packet Size 0 . connection management and port multiplexing. flow control. TCP header size is of 20-60 Bytes.Maximum Throughput Calculation Protocol Overhead= (Segment Size .

which indicate a variety of segment parameters. The field specifies the number of bytes between the current sequence number and that urgent data byte. 48 55 Sequence Number TCP Flags Options and Padding (0 to 40) 56 63 Window Size Sequence No. or customized services or temporary purposes. reserved communication ports. and acknowledgement fields. The value of this field is calculated by adding 1 to the previously received sequence number Offset field: The Offset field is a 4-bit leftmost field that specifies the offset between the data in a TCP segment and the start of the segment. Acknowledgment No: used by the recipient of a segment to request the next segment in the TCP session. . Checksum field: The Checksum field is a 16-bit field that performs error checking for a segment.: a 32-bit field indicting the amount of data sent during a TCP session. they are used for private. in units of 4-byte words. TCP Options field: The optional TCP Options field can range in size from 0 to 320 bits (as long as the number of bits is evenly divisible by 32).over ports feature. Urgent Pointer field: The 16-bit Urgent Pointer field indicates that last byte of a segment’s data that was considered urgent. because the receiving party uses the sequence number as the basis for the acknowledgment number in the next segment it sends back to the sender. and the field can contain a variety of TCP segment pa actual data transfer can begin. y with Ack/Fin. Reserved field: The 3-bit Reserved field is not used. TCP Flags field: The TCP Flags field is comprised of 9 flag bits (also known as control bits ). t number ranging between 0 and 65535. offers the posibilities to provide multiple services to run over different ports at the same time with a port number ranging between 0 and 65535. Out of those 65536 usable ports 0 to 1023 are known as well defined. r transmission and delivered to upper-layer processes at the receiving device. 35 are dynamic or private ports that cannot be registered with IANA. The sending party can be assured that the receiving party really received the data. with the bytes in the same order. and each of the 3 bits are set to a value of 0. Window field: The 16-bit Window field specifies the number of bytes a sender is willing to transmit before receiving an acknowledgment from the receiver.

the window size begins to grow linearly instead of exponentially. n time period (known as the round . which is sometimes called real transfer time ).Connection Maintenance 3-Way HandShake Termination Procedure EndPoint2 |-----------------------------------> <----------------------------------| EndPoint1 Ack. current TCP window size. was previously experienced). or until a configured maximum window size is reached. . Fin Seq=1. hen the original window transmission size can be extended.Ack=461 |-----------------------------------> |--------------------------------------------------------> <--------------------------------------------------------| Ack |---------------------------------------------------------> ceiving 1448 Bytes. ce slow start. ut-of-order packets by either sequencing them in the correct order or by requesting the retransmission of out-of-order packets. At that point. s having reduced window sizes and therefore spending more time waiting for acknowledgments.trip time [RTT] . one segment (that is. f all the segments in a window with a single acknowledgment. MSS only refers to the amount of data in a segment. the receiver sends an ACK asking for the next segment).

.

er3 Layer3 IPv6 OverHead IPv6 Header 40 Bytes Layer3 Payload Payload Variable .

received sequence number. a variety of TCP segment parameters. .

Procedure EndPoint2 Ack. Fin .