To ensure that IP datagrams are transferred in an orderly, efficient, and
reliable manner, TCP implements the following features:
- Connection opening: On the sending
host, a process (such as web browser) issues a request to send data (such as a URL)
to a destination host (such as a web server). TCP creates an initial segment designed to
open the connection between the sender and the receiver (the browser and server). In this
initial contact, the two systems exchange IP addresses and port numbers (to cerate socket
interface) and setup the flow control and sequencing (discussed next)
- Flow control: one of the parameters
that the sending and receiving hosts exchange is number of bytes each is willing to accept
in at on time. This way, one system doesn't end up sending more data the other system can
handle. This value can move up or down as the circumstances change on each machine, so the
systems exchange this information constantly to ensure efficient data transfer.
- Sequencing: Every segment is
assigned a sequence number (or, technically, the first data byte in every segment is
assigned a sequence number). This technique lets the receiving host reassemble any
segments that arrive out of order.
- Acknowledgement: When TCP transmits
a segment, it holds the segments a queue until the receiving TCP issues an
acknowledgement that he has received the segment. If the sending TCP doesn't receive this
acknowledgement it retransmits the segment.
- Error detection: A checksum value
in the header lets the receiver test the integrity of an incoming segment. If is
corrupted, the receiver fires back an error message to the sender, which then immediately
retransmits the segment.
- Connection closing: when the
process on the sending host indicates that the connection should be terminated, the
sending TCP sends a segment that tells the receiver that no more data will be sent and the
socket should be closed.
- These features illustrate why Internet communication are
generally reliable. They show that TCP acts as a sort chaperone for the IP datagram
traveling from host to host.