|  | 12.3 | TCP Connection Methods
| 12.3.2 | Three-way handshake/open connection
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 consistent grade of service. During the data transfer phase, data is transmitted sequentially over the established path, arriving 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/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 that may occur later 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 acknowledgement of x + 1, and includes its own initial sequence number of y. The acknowledgement number of x + 1 means the host has received all octets up to and including x, and is expecting x + 1 next. Positive acknowledgement and retransmission, or 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 acknowledgement before sending the next packet. If the timer expires before the source receives an acknowledgement, the source retransmits the packet and starts the timer over again. Window size determines the amount of data that you can transmit at one time before receiving an acknowledgment from the destination. The larger the window size number (bytes), the greater the amount of data that the host can transmit. After a host transmits the window-sized number of bytes, 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 1, each individual (1) segment must be acknowledged before you can send the next segment. TCP uses expectational acknowledgments, meaning 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 inefficient use of bandwidth by the hosts. Windowing is a flow control mechanism requiring that the source device receive an acknowledgement 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 acknowledgement. If the destination receives the three octets, it sends an acknowledgement to the source device, which can now transmit three more octets. If, for some reason, the destination does not receive the three octets, for example, due to overflowing buffers, it does not send an acknowledgement. Because the source does not receive an acknowledgement, 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 re-transmitted. Segments that are not acknowledged within a given time period result in re-transmission.