Authors Top

If you have a few years of experience in Computer Science or research, and you’re interested in sharing that experience with the community, have a look at our Contribution Guidelines.

1. Introduction

Transmission Control Protocol (TCP) is helpful to send a file or message over a connected network. Each file gets divided into packets at the sender network. The packets get merged on arrival at the receiving network. The maximum size of a TCP packet is 64K (65535 bytes). Generally, the packet size gets restricted by the Maximum Transmission Unit (MTU) of network resources. MTU is the maximum size of the data transfer limit set by hardware in a network. The packet size should never exceed MTU.  In this tutorial, we’ll try to explain the concept behind each of these terms and explore various aspects of it.

2. TCP Connection

TCP connection uses TCP, one of the core protocols in the internet protocol suite, and offers a dependable protocol for digital communication. TCP receives messages from a network resource such as a server, router, switches, splits them into packets, and finally forwards them to the target network resource. Almost all connections involving the internet uses a TCP connection. We’ll explain more about how the packet works in subsequent sections. Let’s take the example of email communication to understand TCP communication: osi-model We can see from the above figure an email undergoes processing through the seven layers of the OSI modelEach layer of the source server communicates to the corresponding layer of the target server. In the Application Layer, the email client uses SMTP protocol to communicate with the email server when we send an email. The Presentation Layer converts our mail into ASCII and images. The Session Layer establishes and maintains the connection with the target server. The Transport Layer splits the message into multiple packets and adds port information of both source and destination serversThe Network Layer defines the routing path of packets by adding corresponding IP addresses. It is interesting that even if each packet is travelling for the same target, the route they use to travel may be different. Data Link Layer prepares the packet to transfer over the Ethernet, and the Physical Layer eventually transmits the frame over the physical connection like LAN cable, WiFi, or broadband. The following figure explains the above process: osi-model-example When the packets arrive at the Physical Layer of the target network (Host2 in the above figure), each layer at the target email server processes the packets to retrieve the data and show our email in the target Inbox.

3. Frame & Packet 

Digital data exchange within a computer network uses frames and packets. The main difference between frame and packet is that frame is the serial collection of bits, and a packet is the fragmented data encapsulated in a frame. A packet is a single data unit within the Network Layer in the OSI model.   Each packet generally includes a header and a payload. The header has the port & IP address of the source and destination network device. The data or message content is the payload.  For example, when we transfer an image file, the file is divided into several packets. The packets contain parts of the image that travel separately. The packets get rejoined by the receiving network device to reconstruct the image file. In the end, they get combined to retrieve the same image file: packet-example The packet contains information for directing them to the target address and information for checking transmission error and data integrity. Splitting data efficiently helps the network manage different network parameters, such as bandwidth, route, and device connections.

4. Why Packet Size Is Important?

The packet loss rate is dependent on the packet size. The large is the packet size, the more probability of packet loss. The packet size causes different impacts on the communication network parameters like the packet loss rate and the throughput.   We must keep the packet size below MTU for better TCP connection performance. The maximum packet size should be in the range of 1500 bytes (broadband) and 576 bytes (dial-up). router can get the MTU of the target connection from the interface configuration information.

4.1. Advantages

The advantages of packet-based TCP communication are the following:

    • Efficiently use of the bandwidth of a network.
  • Variable packet sizes are used based on the communications standard. 
  • Each packet travels independently based on the optimal network route.
  • Require no dedicated channel for routing packets but use any available network path connecting to the destination network.
  • Configure packet size using the feature of an operating system.
  • A small packet size can give better network latency

4.2. Disadvantages

The disadvantages of a packet-based TCP connection are the following:

  • Configuring the packet size higher than the MTU can lead to jabbering.
  • A  small packet size may result in slow transmission.
  • When the maximum packet size exceeds the network’s physical MTU, it impacts performance. 

5. Fragmentation of Packets for Different MTUs 

Let’s assume a source device using TCP communication that sends an IP packet over the network. The packet size must be smaller than the MTU of the target and intermediary network. This restriction is by the network data link layer and hardware MTUs. So what happens if the packet is larger than the MTU of the intermediary network or target device? The answer is to halve the packet further into pieces, and this process is known as fragmentation. The individual pieces are fragments that are then rejoined at the target network to retrieve the complete packet. However, depending on the type of IP protocol, such as IPv4 and IPv6 following conditions may occur:

  • IPv4: When the Don’t Fragment (DF) flag is active, the fragmentation of the packet is not possible. If DF status is inactive, the router can split a packet into fragments. The target device can rejoin the fragments later. It will return the packet to the source network without fragmentation.
  • Pv6: Packets can’t get fragmented by routers and returned to the source network.

Let’s now see how fragmentation works. The following figure shows a  source data link or MTU of 1500 Bytes and the target MTU of 1200 Bytes. Considering fragmentation is allowed, the packet size of 1400 Bytes gets divided into 1200 Bytes and 200 Bytes: packet-header-example We must be wondering what happens to the original packet during fragmentation? They get discarded, and the data within them gets fragmented.

5.1. Advantages

5.2. Disadvantages

  • Loss of a fragment may require resending the packet and initiating the fragmentation again.
  • The first fragment only contains the header that may lead to issues with the devices that depend on inspecting the headers.
  • Fragmentation may need reordering, particularly if few packets are only fragmented.

6. Importance of MTU

MTU is a unit of estimation indicating the maximum size of a data bundle that a network resource can acknowledge effectively. It’s the most important parameter that the other networks should know for establishing a TCP connection. A larger MTU supports more data to fit within lesser packets, resulting in faster and improved transmission performance. However, if an error occurs in communication, the packet takes longer to re-transmit. A smaller MTU can improve network latency.

6. Conclusion

This article provides an overview of the maximum packet size for a TCP connection. First, we discussed the concept of packet size. We then talked about the importance of knowing packet size. Information about the packet size for TCP connection is beneficial in understanding the TCP connection performance. To conclude, the source network has to make sure that the packet size should not exceed the MTU of the target network.

Authors Bottom

If you have a few years of experience in Computer Science or research, and you’re interested in sharing that experience with the community, have a look at our Contribution Guidelines.

Comments are closed on this article!