The transport layer receives data from the application, and breaks it into chunks called segments, and sends them to the network router for delivery. Two transport layer protocols are used on the Internet.
The transmission control protocol (TCP) is used for applications in which reliable connections between hosts are necessary. TCP checks for transmission errors, lost packets, packets out of order, etc, and tries to automatically correct these without "bothering" the application program. It also does flow control, slowing transmission if it is too fast for the receiver.
The user datagram protocol (UDP), is an unreliable transport protocol with no sessions or flow control and optional error checking. UDP just sends packets as soon as requested and forgets about them. It is faster than TCP, and is suitable for isochronous applications like voice over IP (VOIP) or streaming video where error correction is pointless.
Let's consider an example in which a user wishes to retrieve a Web page at bpastudio.csudh.edu. The application program (a Web client in this case) would use TCP since reliable transport is desired.
The user enters the URL: http://bpastudio.csudh.edu/fac/lpress.
When the user hits the Enter key, the application program tells TCP to send the message:
Get: http://bpastudio.csudh.edu/fac/lpressto the Web server at bpastudio.csudh.edu.
To do this, the TCP program adds header information to the message. You can think of it as putting the message in an envelope. The header (envelope) is 24 bytes long and has 13 fields. The key ones are:
To summarize, TCP tasks include: