Transmission Control Protocol
Transmission Control Protocol (TCP) supports the network at the transport layer. Transmission Control Protocol (TCP) provides a reliable connection oriented service. Connection oriented means both the client and server must open the connection before data is sent. TCP is defined by RFC 793 and 1122. TCP provides:
- End to end reliability.
- Data packet re sequencing.
- Flow control.
TCP relies on the IP service at the network layer to deliver data to the host. Since IP is not reliable with regard to message quality or delivery, TCP must make provisions to be sure messages are delivered on time and correctly (Federal Express?).
TCP Message Format
The format of the TCP header is as follows:
- Source port number (16 bits)
- Destination port number (16 bits)
- Sequence number (32 bits) - The byte in the data stream that the first byte of this packet represents.
- Acknowledgement number (32 bits) - Contains the next sequence number that the sender of the acknowledgement expects to receive which is the sequence number plus 1 (plus the number of bytes received in the last message?). This number is used only if the ACK flag is on.
- Header length (4 bits) - The length of the header in 32 bit words, required since the options field is variable in length.
- Reserved (6 bits)
- URG (1 bit) - The urgent pointer is valid.
- ACK (1 bit) - Makes the acknowledgement number valid.
- PSH (1 bit) - High priority data for the application.
- RST (1 bit) - Reset the connection.
- SYN (1 bit) - Turned on when a connection is being established and the sequence number field will contain the initial sequence number chosen by this host for this connection.
- FIN (1 bit) - The sender is done sending data.
- Window size (16 bits) - The maximum number of bytes that the receiver will to accept.
- TCP checksum (16 bits) - Calculated over the TCP header, data, and TCP pseudo header.
- Urgent pointer (16 bits) - It is only valid if the URG bit is set. The urgent mode is a way to transmit emergency data to the other side of the connection. It must be added to the sequence number field of the segment to generate the sequence number of the last byte of urgent data.
- Options (variable length)