10. Task of the transport layer

10.2. 3-part reconciliation

TCP is a connection protocol, which means that before a source host can send any data to a destination host, a connection must be established between them. This combination is called a three-way handshake. The source host, i.e. the client, sends a segment containing the SYN flag (SYN is a serial number synchronisation flag), and the segment also contains the client's random serial number (also called the ISN, SEQ=100), which is used for subsequent merged data fragments.

On receipt of this segment, the destination host, i.e. the server, is informed that the client wishes to establish a connection with it. In response, the server sends a segment with the SYN and ACK flags set (the ACK flag informs the client that the server has received the previous segment), the sequence number received from the client is incremented by 1 (ACK = 101) and its random sequence number (SEQ = 300).

Finally, the client sends the segment back to the server with the ACK flag set, acknowledging receipt of the previous message with the server sequence number incremented by 1 (SEQ=101, ACK=301). This completes the connection process and allows the data to be transmitted correctly. Only after a TCP connection has been established with the server can the client send the relevant data, such as a request for a web page or file.

Finally, when all data has been transmitted, the session must be closed. The client then sends a segment to the server with the FIN flag, which informs the server of its intention to close the session, which responds with an acknowledgement segment with the ACK flag that it has received such a segment. The server then also sends a segment with the FIN flag, and the client responds with an acknowledgement segment with the ACK flag. This causes the TCP session to be closed.

Flag

Application

URG

Indicates the existence of an urgency indicator field in the header (urgent)

ACK

Indicates the existence of an acknowledgment number field in the header.

PSH

Forced packet transmission (push)

RST

Reconnecting (reset)

SON

Synchronisation of sequential numbers

FIN

End of data from sender