TCP

TCP is a transport layer protocol that helps to establish connections. TCP means Transmission Control Protocol. It guarantees secure data transmission between two network-connected devices. The data can only be sent when a secure connection has been established.

The receiver sends an acknowledgment of receiving the data after receiving it. To transfer data between devices, it uses data blocks. It has more system functionalities, including flow control, error control, and congestion control, but it transmits data slowly. The TCP header is 20-60 bytes long and contains a variety of information to improve reliability.  TCP is used by protocols like HTTP, FTP, etc. for secure data transmission over networks because of its dependability.

Working Of TCP

To ensure that every message reaches its destination without being affected, the TCP/IP model breaks the data up into small bundles, which are then reassembled into the original message on the other end.

Instead of sending everything at once, sending the information in smaller bundles of information makes it easier to maintain efficiency. When a message is divided into bundles, if one route is cramped and the destination is the same, then the bundles may travel along different routes.

For example, when a user wants to open a web page on the internet, the server processes that request and sends the user response in the form of an HTML page. The HTTP Protocol is the one that the server uses. To send the HTML file, the HTTP asks the TCP layer to establish the necessary connection.

The data is now divided into small packets by the TCP, which sends them to the IP layer. The packets are transmitted via various routes to their destination. When the transmission is completed and all packets have been received, the TCP layer in the user's system acknowledges.

Features of TCP

TCP has following features:

Stream Data Transfer

Applications at the Application Layer send a continuous stream of bytes to the lower layers. It is TCP's responsibility to divide this byte stream into packets called TCP segments, which are sent over the IP layer to the destination device. The application doesn't need to worry about the byte stream data packets being corrupted.

Reliable

TCP's most important feature is its ability to deliver data reliably. To ensure dependability, the data that is corrupted, misplaced, duplicated, or delivered by the Network Layer must be restored by TCP. Each byte sent over TCP has a unique sequence number, and the receiving TCP layer is required to respond for each byte. The data is retransmitted if acknowledgment is not received by the sender.

Addressing Of TCP

Port numbers are used for TCP communication between distant hosts (TSAPs). The port numbers, which can range from 0 to 65535, are divided as follows:

  • Device Ports (0 – 1023)
  • User Ports ( 1024 – 49151)
  • Dynamic/Private Ports (49152 – 65535)

Bandwidth Management

TCP employs the concept of window size to meet the need of bandwidth management. The window size tells the sender at the remote end that how many data byte segments can be received at this end.

The window size decreases to half, and the slow start phase resumes if an acknowledgment is missed.

Error Control and Free Control

The application process that the data segment is determined by TCP using the port numbers. It also uses sequence numbers to synchronize with the remote host. Each sent and received data segment has a unique sequence number. The sender is informed by the last data segment that the receiver has received when it receives an ACK. Using the sequence number of a recently received packet, the Receiver can determine the last segment that the Sender sent.

If the sequence number of a recently received segment does not match the sequence number expected by the receiver, the segment is discarded and NACK is returned.

Connection Management

TCP operates using a Server/Client model. The server either accepts or rejects the connection request made by the client. Connection management is accomplished through three-way handshaking.

Establishment of Connection

The client initiates the connection and sends the segment, which includes a Sequence number. The server responds with its Sequence number and an ACK of the client's segment that is greater than the client's Sequence number.

After receiving an ACK for its segment, the client sends an acknowledgment of the Server's response.

Release

TCP segments with the FIN flag set to 1 can be sent either by the server or the client. The TCP communication direction is closed and the connection is released when the receiving end responds with an acknowledging FIN.

Multiplex

Multiplexing is the process of combining two or more data streams into a single session. A well-defined port number that identifies the application process is always referred when a TCP client establishes a connection with a server. A port number is randomly selected by the client from a private port number pool.

TCP multiplexing allows a client to communicate with multiple application processes at once. For example, a customer requests a web page that contains different types of data (HTTP, SMTP, FTP, etc.) The TCP session timeout is extended and the session is kept open for longer time to avoid the overhead of the three-way handshake.

Because of this, the client system can receive multiple connections over a single virtual connection. If the timeout is excessively long, these virtual connections are bad for servers.

Congestion Control

Congestion occurs when a large amount of data is fed into a system that is incapable of handling it. TCP manages congestion using the Window mechanism. TCP specifies a window size that tells the other end how many data segments to send. TCP can use one of three algorithms to control congestion:

  • Additive increase, Multiplicative Decrease
  • Slow Start
  • Timeout React

Crash Recovery

TCP is a very dependable protocol. It assigns a sequence number to each byte sent in a segment. It provides a feedback mechanism, through which host acknowledges a packet when it arrives with the awaited next sequence number (if it is not the last segment).

A TPDU broadcast is sent to all of the hosts on a TCP Server when it restarts after crashing in the middle of a conversation. After that, the hosts can send the final data segment, which was never unacknowledged, and continue.

Advantages Of TCP

  • It is a dependable protocol.
  • It includes an error-checking mechanism as well as a recovery mechanism.
  • It regulates flow.
  • It ensures that the data arrives at its intended destination in the exact order in which it was sent.
  • No organization or individual owns the Open Protocol.

Disadvantages Of TCP

  • TCP was designed for Wide Area Networks, so its size may be an issue for small networks with limited resources.
  • TCP operates at several layers, which can slow down network performance.
  • It is not generic in any way. In other words, it can only represent the TCP/IP suite of protocols.

Conclusion

TCP is a transport layer protocol that helps to establish connections. TCP means Transmission Control Protocol. It guarantees secure data transmission between two network-connected devices. The data can only be sent when a secure connection has been established.



ADVERTISEMENT
ADVERTISEMENT