The transport layer: TCP and UDP

Software at the transport layer is responsible for establishing temporary communication sessions between two application programs, and delivering data as requested by those applications. (When you make a phone call, a temporary session is established between you and the person you are calling).

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/lpress
to 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:

In this example, the destination host has the domain name bpastudio.csudh.edu, and the source host would be the users machine. There may be many programs running on bpastudio.csudh.edu, and the port number designates which of those programs the information is addressed to. In this example, it is being sent to the program that is listening on port 80. Port 80 is typically, though not always used by the HTTP protocol. Other programs running on bpastudio.csudh.edu would be listening on different ports.

To summarize, TCP tasks include:


Disclaimer: The views and opinions expressed on unofficial pages of California State University, Dominguez Hills faculty, staff or students are strictly those of the page authors. The content of these pages has not been reviewed or approved by California State University, Dominguez Hills.