Skip to content
Skip to main content

About this free course

Download this course

Share this free course

Protocols in multi-service networks
Protocols in multi-service networks

Start this free course now. Just create an account and sign in. Enrol and complete the course for a free statement of participation or digital badge if available.

3.4.1 Connection control

TCP does not assume a reliable communication network and takes precautions against the loss or duplication of protocol data units. One method is the three-way handshake procedure for establishing a connection between two hosts. Figure 18 shows the TCP procedure for this. This connection is a virtual connection of the type described in Section 2; many virtual connections can share a physical communication channel.

Figure 18
Figure 18 TCP three-way handshake procedure

The condition of the control flags in TCP segments determines how a host will interpret the segments it receives. The first protocol data unit (segment) from host A to host B is in effect a ‘connection request message’. This is indicated by the SYN flag being active. The value in the sequence number field indicates the initial sequence number, x, which means that the sequence number of the first data byte that A is going to send to B is x  +  1. The value of x is chosen by A to minimise the risk of duplicated sequence numbers. Host B responds by sending an ‘acknowledgement and connection request message’ to A. This is indicated by both the SYN flag and the ACK flag being active. The acknowledgement number field contains the value x  +  1, which is the first sequence number host B expects to receive. The initial sequence number chosen by B to transmit its data in this example is represented by the letter y. In the final stage of the three-way handshake, host A sends an ‘acknowledgement message’. This message has the ACK flag active and the acknowledgement number equals y + 1. Figure 18 shows that this is followed by user data sent between the two hosts.

Although not shown in Figure 18, the segments that set up a connection may contain user data in the data field, but the receiving host should not deliver this data until the connection has been established.

Figure 18 also shows an example of closing a connection in both directions. Host A first requests the connection to be closed. Host B acknowledges this request and in a separate message requests that the connection in the opposite direction is closed also. Notice that the values of the acknowledgement and sequence number fields make certain that there is no ambiguity about how much data has been received by each host.