In Information technology, a packet is collection of data that can be used by computers which need to communicate with each other, usually as part of a network. Some computers and networks do not use packets to communicate. But most currently do, including nearly all computers on the Internet. Packets allow many computers on a network to communicate more quickly and easily.
Structure[change | change source]
A packet consists of two kinds of data: control information and user data (or payload). If you think of a packet like a letter in the mail, the control information is like the outside of the envelope. There's an address that says where to send the letter, and a stamp that says how to send it (fast or slow). Similarly, the computer uses the control information in the packet to decide where, and how, to send the data. People aren't usually interested in the control information.
The user data is like the inside of the envelope. It is the actual information the computer is trying to send. This might be the contents of a web page, or a user's name and address, for example. It's generally more for people's use, and less for the computer's use.
Different communication protocols put the control information and user information in different places, or make it look different. But they still do the same thing.
Problems[change | change source]
Sometimes the computers make mistakes while transmitting data, or have trouble "hearing" each other. So many packets use a checksum or cyclic redundancy check to make sure they have the right information. This is usually one component of the control information. This helps to make sure the packets themselves have the right information. But then computers also need to get the right packets.
Designing computer networks can be difficult. Even though today's computers are very advanced, sometimes information doesn't arrive where it's supposed to. Sometimes computers try to fix this and end up sending it twice. And sometimes the information doesn't arrive in the right order. The Transmission Control Protocol, or TCP, was invented to fix these problems. But since it is complex, some computers use the User Datagram Protocol, or UDP, instead.