(TCP) Transmission Control Protocol (TCP) - Header, Definition - Javatpoint
(TCP) Transmission Control Protocol (TCP) - Header, Definition - Javatpoint
Protocol (TCP)?
TCP stands for Transmission Control Protocol. It is a transport
layer protocol that facilitates the transmission of packets from
source to destination. It is a connection-oriented protocol that
means it establishes the connection prior to the communication that
occurs between the computing devices in a network. This protocol is
used with an IP protocol, so together, they are referred to as a
TCP/IP.
The main functionality of the TCP is to take the data from the
application layer. Then it divides the data into a several packets,
provides numbering to these packets, and finally transmits these
packets to the destination. The TCP, on the other side, will
reassemble the packets and transmits them to the application layer.
As we know that TCP is a connection-oriented protocol, so the
connection will remain established until the communication is not
completed between the sender and the receiver.
Reliable
This protocol ensures that the data reaches the intended receiver in
the same order in which it is sent. It orders and numbers each
segment so that the TCP layer on the destination side can
reassemble them based on their ordering.
Connection-oriented
Full duplex
Stream-oriented
Working of TCP
In TCP, the connection is established by using three-way
handshaking. The client sends the segment with its sequence
number. The server, in return, sends its segment with its own
sequence number as well as the acknowledgement sequence, which
is one more than the client sequence number. When the client
receives the acknowledgment of its segment, then it sends the
acknowledgment to the server. In this way, the connection is
established between the client and the server.
Advantages of TCP
It provides a connection-oriented reliable service, which means
that it guarantees the delivery of data packets. If the data
packet is lost across the network, then the TCP will resend the
lost packets.
It provides a flow control mechanism using a sliding window
protocol.
It provides error detection by using checksum and error control
by using Go Back or ARP protocol.
It eliminates the congestion by using a network congestion
avoidance algorithm that includes various schemes such as
additive increase/multiplicative decrease (AIMD), slow start, and
congestion window.
Disadvantage of TCP
It increases a large amount of overhead as each segment gets its
own TCP header, so fragmentation by the router increases the
overhead.
Window size
It is a 16-bit field. It contains the size of data that the receiver
can accept. This field is used for the flow control between the
sender and receiver and also determines the amount of buffer
allocated by the receiver for a segment. The value of this field is
determined by the receiver.
Checksum
It is a 16-bit field. This field is optional in UDP, but in the case of
TCP/IP, this field is mandatory.
Urgent pointer
It is a pointer that points to the urgent data byte if the URG flag
is set to 1. It defines a value that will be added to the sequence
number to get the sequence number of the last urgent byte.
Options
It provides additional options. The optional field is represented
in 32-bits. If this field contains the data less than 32-bit, then
padding is required to obtain the remaining bits.