A packet is a formatted unit of data transmitted over packet-switched networks, such as the internet or Local Area Networks (LANs). To transmit data efficiently, large files or command strings are broken down into smaller segments. Each segment is encapsulated in a packet containing the user data (payload) and control information (header).
The header functions like a shipping label, containing the necessary details for routing and reassembly. Key information typically includes:
- Source and destination IP addresses
- Source and destination port numbers
- Sequence numbers (to verify the data order)
- Checksums (for error detection)
Routers and switches use this header information to direct the packet to its destination. Upon arrival, the receiving device reassembles the packets into the original data stream. This approach ensures high reliability; if a packet is lost or corrupted, only that specific packet needs to be retransmitted rather than the entire file.
The packet size is defined by the Maximum Transmission Unit (MTU). For standard Ethernet networks, the MTU is typically 1,500 bytes.