| 9.1 |  | Transport Protocols |
| 9.1.2 |  | TCP detailed review |

| TCP segment The TCP segment fields can be viewed in Figure . Three way handshake Connection-oriented services involve three phases:

- In the connection establishment phase, a single path between the source and destination is determined. Resources are typically reserved at this time to ensure a consistent grade of service.
- During the data transfer phase, data is transmitted sequentially over the established path. The data then arrives at the destination in the order in which it was sent.
- The connection termination phase consists of terminating the connection between the source and destination when it is no longer needed.

TCP hosts establish a connection-oriented session with one another using a three-way handshake. A three-way handshake, or open connection sequence, synchronizes a connection at both ends before data is transferred. This exchange of introductory sequence numbers during the connection sequence is important. It ensures that any data that is lost due to transmission problems can be recovered.

First, one host initiates a connection by sending a packet indicating its initial sequence number of x with a certain bit in the header set to indicate a connection request . Second, the other host receives the packet, records the sequence number of x, replies with an acknowledgment of x + 1, and includes its own initial sequence number of y. The acknowledgment number of x + 1 means the host has received all octets up to and including x, and it is expecting x + 1 next .

Positive acknowledgment and retransmission (PAR), is a common technique many protocols use to provide reliability. With PAR, the source sends a packet, starts a timer, and waits for an acknowledgment before sending the next packet. If the timer expires before the source receives an acknowledgment, the source retransmits the packet and starts the timer again.

Window size determines the amount of data that can be transmitted at one time before receiving an acknowledgment from the destination . The larger the window size, the greater the amount of data that the host can transmit. After a host transmits the number of bytes specified by the window size, the host must receive an acknowledgment that the data has been received before it can send any more messages. For example, with a window size of one, each individual segment must be acknowledged before the next segment can be sent.

TCP uses expectational acknowledgments. This means that the acknowledgment number refers to the octet that is next expected. The ‘sliding’ part of sliding window refers to the fact that the window size is negotiated dynamically during the TCP session. This results in efficient use of bandwidth by the hosts.

Windowing is a flow control mechanism requiring the source device to receive an acknowledgment from the destination after transmitting a certain amount of data . For example, with a window size of three, the source device can send three octets to the destination. It must then wait for an acknowledgment. If the destination receives the three octets, it sends an acknowledgment to the source device, which can now transmit three more octets. If the destination does not receive the three octets for some reason, such as overflowing buffers, it does not send an acknowledgment. Because the source does not receive an acknowledgment, it knows that the octets should be retransmitted and that the transmission rate should be slowed.

TCP provides sequencing of segments with a forward reference acknowledgment. Each datagram is numbered before transmission. At the receiving station, TCP reassembles the segments into a complete message. If a sequence number is missing in the series, that segment is retransmitted. Segments that are not acknowledged within a given time period are retransmitted.