All application processes running and configured on the server use different port numbers. The network administrator can use these port by default or also can configure these ports manually. 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 considered to open, which means that the transport layer accepts and processes segments addressed to that specific port number. Every incoming client request accepted to the correct socket address, and the application passes the data to the server. There is the possibility to many open ports 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. Connections on the network are similar to the handshaking and welcoming of friends. The host and server, as well as two hosts, set up a TCP connection.
1 – The initiating client sends requests a client-to-server communication session with the server.
2 – After receiving the ask the server acknowledges the client-to-server communication session and requests a server-to-client communication session.
3 – Then the initiating client acknowledges the server-to-client communication session.
TCP Session Termination
For connection closing, the FIN control flag must 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 used. So, to end a single TCP conversation, four exchanges required to end both sessions.
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.
2 – The Host-B sends an ACK to acknowledge the receipt of the FIN to finish session from Host- A to Host-B.
3 – The Host-B sends a FIN to the Host-A to finish the Host-B to Host-A session.
4 – The Host-A responds with an ACK to acknowledge the FIN from the Host-B.
The session is terminated when all segment acknowledgment received.
The Figure below illustrates the TCP session termination process.