TCP: (Transport Control Protocol)

What is TCP?

TCP header

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


What is TCP?

  1. packetizes the user data into segments

  2. sets a time out any time it sends data

  3. acknowledges data received by the other end

  4. reorders out-of-order data

  5. discards duplicate data

  6. provides end to end flow control

  7. calculates and verifies mandatory end to end checksum

 

<--- IP datagram --->

IP header TCP header TCP data

 

 

 

 


Format for a TCP header

16-bit source port number 16-bit destination port number
32-bit sequence number
32-bit acknowledgment number
4-bit header length 6-bits reserved Flags 16-bit window size
16-bit TCP checksum 16-bit urgent pointer
options (if any)
data (if any)

 

Source port number - This port number along with the IP address in the IP header uniquely identifies the source.

Destination port number - This port number along with the IP address in the header uniquely identifies the destination.

Sequence number - TCP provides full duplex to the application layer. With data flowing independantly in both directions each end must maintain its own sequence number.

Acknowledgment number - This number indicates the next sequence number the sending host expects to receive next from the destination host. TCP is a sliding window protocol, ie: the window slide back and forth depending on the acknowledment number.

Header length - The length of the header in 32 bit words. TCP is limited to 60 byte header.

Flags - There are 6 flags:

  1. URG - Urgent pointer is valid.
  2. ACK - Acknowledgment number is valid.
  3. PSH - Receiver should pass this data to the application ASAP.
  4. RST - Reset the connection.
  5. SYN - Synchronize sequence numbers to initiate a connection.
  6. FIN - The sender is finished sending data.

Window size - This is the number of bytes, starting with the one specified by the acknowledgement number field, that the receiver is willing to accept. This is a type of flow control where each end advertises a window size.

Checksum - Is the checksum of the bytes in the TCP header + TCP data

Urgent pointer - This pointer is valid only if the Urgent flag is set. It is a positive offset that must be added to the sequence number field of the segment to yield the sequence number of the last byte of urgent data.