written 7.8 years ago by |
- TCP is a transport layer protocol used by applications that require guaranteed delivery.
- The endpoints are defined by an IP address and a TCP port number. TCP works in full duplex mode and has various fields. It provides handling for both timeouts and re-transmission as it follows sliding window protocol.
The TCP header is of 20 byte and the format for data delivery is defined as
It consists of various fields as follows:
a) Source port address (0-15 bit): It is the source port of the packet. The port is bound directly to a process on the sending system.
b) Destination port address (16-31 bit): It is the destination port of the packet. The port is bound directly to a process on the receiving system.
c) Sequence number (332-63 bit): It is used for proper sequencing of the data packets. The sequence number field is used to set a number on each TCP packet.
d) Acknowledgement number (64-95 bit): It is used when we acknowledge a specific packet when a host has received it. If the ACK bit is set, this field contains the value of the next sequence number the sender of the segment is expecting to receive.
e) Data offset bit (96-99 bit): It indicates the start of data in the packet. The length of the TCP header is always a multiple of 32 bits.
f) Reserved bit (100-105 bit): They are reserved for future use. Normally they are set to zero to be fully compliant.
The control bits are as stated as below:
a) Urgent (URG bit 106): It indicates if we need to use Urgent pointer field or not. If it is set to 1 then only we use Urgent pointer.
b) Acknowledgement (ACK bit 107): It is set when an acknowledgement is being sent to the sender.
c) PUSH flag (PSH bit 108): When the bit is set, it tells the receiving TCP module to pass the data to the application immediately.
d) Reset flag (RST bit 109): When the bit is set, it aborts the connection. It is also used as a negative acknowledgement against a connection request.
e) Synchronize flag (SYN bit 110): It is used during the initial establishment of a connection. It is set when synchronizing process is initiated.
f) Final flag (FIN bit 111): The bit indicates that the host that sent the FIN bit has no more data to send.
Window field (bit 112-27): It is used to tell the sender how much data the receiver permits at the instance. The process is used for flow of data and congestion.
Checksum (bit 128-143): It is used for error detection on the TCP segment.
Urgent pointer (bit 144-159): It is used to indicate the end of urgent data frame. It points to the sequence number of the octet following the urgent data.
Options and padding (bit 1560-end):
a) Option field: It is used to contain optional header. It contains field that are not covered in the header.
b) Padding: It is done if the length of the option filed is not multiple of 32. It consists of only zeroes.
Data: Although not used in some circumstances (e.g. acknowledgement segments with no data in the reverse direction), this variable length field carries the application data from TCP sender to receiver. This field coupled with the TCP header fields constitutes a TCP segment.