TCP provides error-correction through the use of a connection-oriented transaction.
Whenever an application needs to send data to another host, TCP builds a
“start” segment and sends it to the destination node. When the other system sends
a “start” segment back (along with an acknowledgment that it got the first segment),
a monitored conversation between the two systems begins.
TCP works in much the same way as a telephone conversation. When an application
wants to trade data with another system, it first tries to establish a workable
session. This is similar to you calling another person on the phone. When the
other party answers (“Hello?”), they are acknowledging that the call went through.
You then acknowledge the other party’s acknowledgment (“Hi Joe, this is Eric”),
and begin exchanging information.
TCP segments are encapsulated within IP datagrams. They still rely on IP to get
the data where it’s going. However, since IP doesn’t offer any guarantees regarding
delivery, TCP has to keep track of the status of the connection at all times.
This is achieved through the use of sequence numbers and acknowledgment flags
embedded within the TCP header. Every byte of data sent over TCP must be
acknowledged (although these acknowledgments are usually clumped together). If
one of the systems does not acknowledge a segment, then TCP will resend the
The use of sequence numbers also allows TCP to implement flow control and
other services on top of IP. Applications can send as much data as they need to,
and TCP will break the data into chunks that will fit within IP segments. If the
receiving system is unable to process data quickly enough, it can tell the sending
system to slow down, thereby reducing the likelihood that data will get lost.
In addition, it is important to realize that TCP offers a byte-stream service for applications
to use whenever they need to read and write data. Whenever an application
needs to send data—whether that data is a 20-byte message or a two-megabyte
file—the application can send the data in a stream to TCP, where it will be converted
into manageable chunks of data that are sent (and tracked) over IP cleanly.
Once the IP datagrams are received by the destination system, the data is made
available to the destination application immediately, where it can be read and
processed.
Applications such as the Internet’s Simple Message Transport Protocol (SMTP) and
Hypertext Transfer Protocol (HTTP) both require the reliable and controlled connection
services that TCP provides. In addition, these types of application protocols
also benefit from TCP’s streaming model, allowing the applications to send
data as a continual stream of bytes that will be read and processed by the recipient
upon their arrival. Without these services, mail messages sent over SMTP and
GIF images sent over HTTP would not flow smoothly, and would likely get garbled.
And since TCP provides these services directly, applications do not have to
embed these routines within their internal application code.
0 comments:
Post a Comment