Transport Layer

The next layer up from the Internetworking layer is the Transport layer. A key element of the Internetworking layer is that it does not attempt to guarantee delivery of any particular packet. The Internetworking layer is nearly perfect, but sometimes packets can be lost or misrouted.

The Transport Layer.

The Transport Layer.

But users of the network want to reliably send entire files or messages across the Internet. A network is not much good to us if all it can do is send packets that are received most of the time. For the network to be useful, all of the packets need to be reassembled into the right order to reconstruct the message on the receiving system. The network must also deal with packets that arrive out of order or never arrive at all. The Transport layer is where we handle reliability and message reconstruction on the destination computer.

Just like the IP layer, the Transport layer adds a small amount of data to each packet to help solve the problems of packet reassembly and retransmission.

Packet Headers

If you were to look at a packet going across one of many links between its source and destination computers, you would see a link header, an IP header, and a Transport Control Protocol (TCP) header, along with the actual data in the packet.

Headers and Data.

Headers and Data.

The link header is removed when the packet is received on one link and a new link header is added when the packet is sent out on the next link on its journey. The IP and TCP headers stay with a packet as it is going across each link in its journey. Remember that a packet may go across several types of link layers as it is routed through the Internet.

The IP header holds the source and destination Internet Protocol (IP) addresses as well as the Time to Live (TTL) for the packet. The IP header is set on the source computer and is unchanged (other than the TTL) as the packet moves through the various routers on its journey.

The TCP headers indicate where the data in each packet belongs. As the source computer breaks the message or file into packets, it keeps track of the position of each packet relative to the beginning of the message or file and places the offset in each packet that is created and sent.

Packet Reassembly and Retransmission

As the destination computer receives the packets, it looks at the offset position from the beginning of the message so it can put the packet into the proper place in the reassembled message. Simply by making sure to put the packet data at the correct position relative to the beginning of the message, the Transport layer easily handles packets that arrive out of order. If it receives a packet further down a message, it places that packet in a buffer, keeping track of the fact that there is now a gap in the message that is being reconstructed. When the earlier packet arrives a moment later, it fits perfectly into the gap in the reassembled data.

To avoid overwhelming the network, the Transport layer in the sending computer only sends a certain amount of data before waiting for an acknowledgement from the Transport layer on the destination computer that the packets were received. The amount of data that the sending computer will send before pausing to wait for an acknowledgment is called the “window size”.

The sending computer keeps track of how quickly it starts to receive acknowledgements from the receiving computer. If the acknowledgments come back quickly, the sending computer increases its window size, but if the acknowledgments come back slowly, the sending computer transmits less data. By adjusting the window size, transmitting computers can send large amounts of data quickly over fast connections that have light loads. When sending data over slow or heavily loaded links, they can send the data in a way that does not overwhelm the network.

If a packet is lost, it will never arrive at the destination computer and so the destination computer will never send an acknowledgment for that data. Because the sending computer does not receive an acknowledgment, it quickly reaches the point where it has sent enough unacknowledged data to fill up the window and stops sending new packets.

At this point, both computers are waiting. The sending computer is waiting for an acknowledgement for a lost packet that will never come and the receiving computer is waiting for a lost packet that will never come. To make sure that the computers do not wait forever, the destination computer keeps track of the amount of time since it received the last packet of data. At some point, the receiving computer decides too much time has passed and sends a packet to the sending computer indicating where in the stream the receiving computer has last received data. When the sending computer receives this message, it “backs up” and resends data from the last position that the receiving computer had successfully received.

Waiting for a Lost Packet.

Waiting for a Lost Packet.

The combination of the receiving computer acknowledging received data, not allowing the transmitting computer to get too far ahead (window size), and the receiving computer requesting the sending computer to “back up and restart” when it appears that data has been lost creates a relatively simple method to reliably send large messages or files across a network.

While the Transport layer is sending a stream of data, it continuously monitors how quickly it receives acknowledgements and dynamically adjusts its window size. This ensures that data is sent rapidly when the connection between two computers is fast and much more slowly when the connection has slow links or a heavy load.

The Transport Layer In Operation

One of the key elements of the Transport layer is that the sending computer must hold on to all of the data it is sending until the data has been acknowledged. Once the receiving computer acknowledges the data, the sending computer can discard the sent data. We can look at this graphically when a message is broken into many packets. Here, the first ten packets of the message have been sent and acknowledged by the destination computer (‘a’). The sending computer has sent six more packets (‘S’), and then stopped because it reached its window size.

Buffering in the Transport Layer.

Buffering in the Transport Layer.

There are three packets that have been sent but not yet received (“S”). Since there are many hops in the network, it is very common for more than one packet to be enroute in the network at the same time.

The Transport layer on the receiving computer has received and acknowledged ten packets and delivered them to the receiving application (‘a’).^[We talk about the Application layer in later material.] The Transport layer on the destination computer has received more three packets (‘R’), but one packet is out of order. Receiving a packet out of order is not a cause for concern if the missing packet arrives in a reasonably short amount of time. As long as all the packets are received, the receiving Transport layer will reconstruct the message, fitting the packets together like puzzle pieces, and deliver them to the receiving application.

Application Clients and Servers

The purpose of the Transport layer is to provide reliable connections between networked applications so those applications can send and receive streams of data. For an application, this is as simple as asking the Transport layer to make a connection to an application running on a remote host. We call the application that initiates the connection on the local computer the “client” and the application that responds to the connection request the “server”. We call the combination of the two networked applications at the ends of the connection a “client/server” application because the two pieces of the application must work together.

A lot of engineering has gone into the lower three layers of our architecture to make it easy to open a connection to a remote computer and then send and receive data over that connection.

Server Applications and Ports

When a client application wants to make a connection to a remote computer, it is important that the connection is made to the correct server application on that remote computer. A remote computer might have any number of different server applications running at the same time. Example server applications would include:

  • Web Server
  • Video Server
  • Mail Server

TCP Ports.

TCP Ports.

For instance, a web client (a browser) needs to connect to the web server running on the remote computer. So a client application not only needs to know which remote computer to connect to, it also needs to choose a particular application to interact with on that remote computer.

We use a concept called “ports” to allow a client application to choose which server application it wants to interact with. Ports are like telephone extensions. All of the extensions have the same phone number (IP Address) but each extension (server application) has a different extension number (port number).

When a server application starts up, it “listens” for incoming connections on the specified port. Once the server application has registered that it is ready to receive incoming connections, it waits until the first connection is made.

So that client applications know which port to connect to, there is a list of well-known default ports for various server applications:

  • Telnet (23) - Login
  • SSH (22) - Secure Login
  • HTTP (80) - World Wide Web
  • HTTPS (443) - Secure Web
  • SMTP (25) - Incoming Mail
  • IMAP (143/220/993) - Mail Retrieval
  • POP (109/110) - Mail Retrieval
  • DNS (53) - Domain Name Resolution
  • FTP (21) - File Transfer

These are the normal ports for these applications. Sometimes servers will make applications available at non-standard ports. If you are doing web development, you may run a web server at a non-standard port like 3000, 8080, or 8888. If you see a URL like:

the “8080” indicates that your browser is going to use the web protocols to interact with the server, but connect to port 8080 instead of the default port 80.


In a sense, the purpose of the Transport layer is to compensate for the fact that the Link and Internetworking layers might lose data. When the two lower layers lose or reroute packets, the Transport layer works to reassemble and/or retransmit that data. The existence of the Transport layer makes it possible for the two lower layers to ignore retransmission and rate-limiting issues.

Part of the goal of a layered architecture is to break an overly complex problem into smaller subproblems. Each layer focuses on solving part of the overall problem and assumes that the other layers solve the problems they are supposed to solve.


acknowledgement: When the receiving computer sends a notification back to the source computer indicating that data has been received.

buffering: Temporarily holding on to data that has been sent or received until the computer is sure the data is no longer needed.

listen: When a server application is started and ready to accept incoming connections from client applications.

port: A way to allow many different server applications to be waiting for incoming connections on a single computer. Each application listens on a different port. Client applications make connections to well-known port numbers to make sure they are talking to the correct server application.


  1. What is the primary problem the Transport (TCP) layer is supposed to solve?
    • a)Move packets across multiple hops from a source to destination computer
    • b)Move packets across a single physical connection
    • c)Deal with lost and out-of-order packets
    • d)Deal with encryption of sensitive data
  2. What is in the TCP header?
    • a)Physical address
    • b)IP Address and Time to Live
    • c)Port number and offset
    • d)Which document is being requested
  3. Why is “window size” important for the proper functioning of the network?
    • a)Because packets that are too large will clog fiber optic connections
    • b)It prevents a fast computer from sending too much data on a slow connection
    • c)It limits the number of hops a packet can take before it is dropped
    • d)It determines what part of an IP address is the network number
  4. What happens when a sending computer receives an acknowledgement from the receiving computer?
    • a)The sending computer resends the data to make sure it was transmitted accurately
    • b)The sending computer sends more data up to the window size
    • c)The sending computer sends an “acknowledgment for the acknowledgment”
    • d)The sending computer sends the acknowledgement to the Internet Map (IMAP)
  5. Which of these detects and takes action when packets are lost?
    • a)Sending computer
    • b)Network gateway
    • c)Core Internet routers
    • d)Receiving computer
  6. Which of these retains data packets so they can be retransmitted if a packets lost?
    • a)Sending computer
    • b)Network gateway
    • c)Core Internet routers
    • d)Receiving computer
  7. Which of these is most similar to a TCP port?
    • a)Train station
    • b)Undersea network cable
    • c)Apartment number
    • d)Sculpture garden
  8. Which half of the client/server application must start first?
    • a)Client
    • b)Server
  9. What is the port number for the Domain Name System?
    • a)22
    • b)80
    • c)53
    • d)143
  10. What is the port number for the IMAP mail retrieval protocol?
    • a)22
    • b)80
    • c)53
    • d)143

Licenses and Attributions

Speak Your Mind