TCP Server Processes

All application processes running on the server are configured to use a different port number. The port can be configured by default or manually, by a network administrator. On the same server cannot have two services assigned the same port number within the same transport layer services. For example, a host running FTP server and a web server cannot have both configured to use the same port (for example, TCP port 80 for both or port 21 FTP server port for both).

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

TCP Connection Establishment

Shake Hands!  When two persons meet each other, they often welcome each other by shaking hands. This act of hands shake is understood by both as a sign for a friendly welcoming. Connections on the network are similar to the handshaking.

A TCP connection between host and server or between two hosts is established in three steps:

Step 1 – The initiating client send requests a client-to-server communication session with the server.

Step 2 – After receiving the request the server acknowledges the client-to-server communication session and requests a server-to-client communication session.

Step 3 – Then the initiating client acknowledges the server-to-client communication session.


TCP Connection Establishment

In the figure, you can see the TCP connection establishment.   

TCP Session Termination

For connection closing, the FIN control flag must be set in the segment header. To end each one-way TCP session, a two-way handshake, with a FIN segment and an Acknowledgment (ACK) segment, is used. So, to terminate a single TCP conversation, four exchanges are required to end both sessions.

Step 1 – When the Host-A Send All data and no more data remain to send in the stream, it sends a segment with the FIN flag set to Host-B.

Step 2 – The Host-B sends an ACK to acknowledge the receipt of the FIN to finish the session from Host- A to Host-B.

Step 3 – The Host-B sends a FIN to the Host-A to finish the Host-B to Host-A session.

Step 4 – The Host-A responds with an ACK to acknowledge the FIN from the Host-B.

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

The Figure below illustrates the TCP session termination process.


TCP Session Termination