Communication over the internet is actually a lot more complicated than two servers sending emails back and forth to each other. Networks send information between machines in something called Packets. A **packet** is basically a container that can hold a certain amount of data (measured in bytes). When you send an email, or a file, or download a web page, the full amount of data you are requesting or sending is actually broken down into several packets, transferred over the network, and then rearranged at the destination.
Network packets consist of three parts:
- The header, which contains information regarding where the packet is from (source IP address), where it’s going (destination IP address, size, protocol, and the packet number (each packet is numbered so they can be rearranged into the completed file at the destination)
- The body (or payload), which contains the actual data that needs to be transmitted over the network. The payload generally occupies the most data space in the packet.
- The footer (or trailer), which signifies the end of the packet, and can also contain some error-checking capabilities such as taking the equivalent of a hash of the data. If the data appears to have changed in transit, the receiver can request the source resend the packet.
As a quick example, let’s say you want to send an email 3,500 bits (3.5 kilobits) in size. The network you send it over uses fixed-length packets of 1,024 bits (1 kilobit). The header of each packet is 96 bits long and the trailer is 32 bits long, leaving 896 bits for the payload. To break the 3,500 bits of message into packets, you will need four packets (divide 3,500 by 896). Three packets will contain 896 bits of payload and the fourth will have 812 bits. Once the packets are downloaded and received at their destination, they are rearranged in the order based on the packet numbers contained in each packet’s header.