fbpx
TCP Communication Process CCNA
TCP Communication Process CCNA

TCP Communication Process

TCP Communication Process
5

Summary

This topic explain how TCP session establishment and termination processes facilitate reliable communication. Start learning CCNA 200-301 for free right now!!

Note: Welcome: This topic is part of Chapter 14 of the Cisco CCNA 1 course, for a better follow up of the course you can go to the CCNA 1 section to guide you through an order.

TCP Server Processes

You already know the fundamentals of TCP. Understanding the role of port numbers will help you to grasp the details of the TCP communication process. In this topic, you will also learn about the TCP three-way handshake and session termination processes.

Each application process running on a server is configured to use a port number. The port number is either automatically assigned or configured manually by a system administrator.

An individual server cannot have two services assigned to the same port number within the same transport layer services. For example, a host running a web server application and a file transfer application cannot have both configured to use the same port, such as TCP port 80.

An active server application assigned to a specific port is considered open, which means that the transport layer accepts, and processes segments addressed to that port. Any incoming client request addressed to the correct socket is accepted, and the data is passed to the server application. There can be many ports open simultaneously on a server, one for each active server application.

Click each button for more information about TCP server processes.

Client 1 is requesting web services and Client 2 is requesting email service using well-known ports (i.e., web services = port 80, email services = port 25).

Clients Sending TCP Requests
Clients Sending TCP Requests

Requests dynamically generate a source port number. In this case, Client 1 is using source port 49152 and Client 2 is using source port 51152.

Request Destination Ports
Request Destination Ports

When the server responds to the client requests, it reverses the destination and source ports of the initial request.

Request Source Ports
Request Source Ports

Notice that the Server response to the web request now has destination port 49152 and the email response now has destination port 51152.

Response Destination Ports
Response Destination Ports

The source port in the server response is the original destination port in the initial requests.

Response Source Ports
Response Source Ports

TCP Connection Establishment

In some cultures, when two persons meet, they often greet each other by shaking hands. Both parties understand the act of shaking hands as a signal for a friendly greeting. Connections on the network are similar. In TCP connections, the host client establishes the connection with the server using the three-way handshake process.

Click each button for more information about each TCP connection establishment step.

The initiating client requests a client-to-server communication session with the server.

SYN TCP Connection
SYN TCP Connection

The server acknowledges the client-to-server communication session and requests a server-to-client communication session.

ACK and SYN TCP Connection
ACK and SYN TCP Connection

The initiating client acknowledges the server-to-client communication session.

ACK TCP Connection
ACK TCP Connection

The three-way handshake validates that the destination host is available to communicate. In this example, host A has validated that host B is available.

Session Termination

To close a connection, the Finish (FIN) control flag must be set in the segment header. To end each one-way TCP session, a two-way handshake, consisting of a FIN segment and an Acknowledgment (ACK) segment, is used. Therefore, to terminate a single conversation supported by TCP, four exchanges are needed to end both sessions. Either the client or the server can initiate the termination.

In the example, the terms client and server are used as a reference for simplicity, but any two hosts that have an open session can initiate the termination process.

Click each button for more information about the session termination steps.

When the client has no more data to send in the stream, it sends a segment with the FIN flag set.

FIN Session Termination
FIN Session Termination

The server sends an ACK to acknowledge the receipt of the FIN to terminate the session from client to server.

ACK Session Termination
ACK Session Termination

The server sends a FIN to the client to terminate the server-to-client session.

FIN terminate session
FIN terminate session

The client responds with an ACK to acknowledge the FIN from the server.

ACK TCP Session Termination
ACK TCP Session Termination

When all segments have been acknowledged, the session is closed.

TCP Three-way Handshake Analysis

Hosts maintain state, track each data segment within a session, and exchange information about what data is received using the information in the TCP header. TCP is a full-duplex protocol, where each connection represents two one-way communication sessions. To establish the connection, the hosts perform a three-way handshake. As shown in the figure, control bits in the TCP header indicate the progress and status of the connection.

These are the functions of the three-way handshake:

  • It establishes that the destination device is present on the network.
  • It verifies that the destination device has an active service and is accepting requests on the destination port number that the initiating client intends to use.
  • It informs the destination device that the source client intends to establish a communication session on that port number.

After the communication is completed the sessions are closed, and the connection is terminated. The connection and session mechanisms enable TCP reliability function.

Control Bits Field

Control Bits Field
Control Bits Field

The six bits in the Control Bits field of the TCP segment header are also known as flags. A flag is a bit that is set to either on or off.

The six control bits flags are as follows:

  • URG – Urgent pointer field significant
  • ACK – Acknowledgment flag used in connection establishment and session termination
  • PSH – Push function
  • RST – Reset the connection when an error or timeout occurs
  • SYN – Synchronize sequence numbers used in connection establishment
  • FIN – No more data from sender and used in session termination

Search the internet to learn more about the PSH and URG flags.

Video – TCP 3-Way Handshake

Click Play in the figure to see a video demonstration of the TCP 3-Way handshake, using Wireshark.

Glossary: If you have doubts about any special term, you can consult this computer network dictionary.

Ready to go! Keep visiting our networking course blog, give Like to our fanpage; and you will find more tools and concepts that will make you a networking professional.

Full Network BundleCourse Offer