TCP: (Transport Control Protocol)
packetizes the user data into segments
sets a time out any time it sends data
acknowledges data received by the other end
reorders out-of-order data
discards duplicate data
provides end to end flow control
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:
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.