Communication protocols are at the heart of data communications. Applications running on networked computers need to exchange data with applications running on other computers, often on other networks. Other devices must also send and receive information over the network in order to function, including networked printers and interconnection devices such as switches and routers. Network devices that wish to communicate with each other must speak the same language. They must use standard messages and a common set of rules that define how communication will take place. These messages, together with the conventions that must be followed in order to ensure successful communication, are collectively called a communications protocol. Such protocols are often described in an industry or international standard.
Protocols exist at every level of a communications system. There are hardware protocols that determine how electrical signals are transmitted over a transmission link, and software protocols that determine how transmission errors are handled and how much information can be sent over the network at a time. There are a number of different communication protocols that can perform the same function, but if communication is to be successful, both end points using a communications channel must be using the same protocol. Communication systems have a layered architecture that allows the functionality required at each layer to be engineered independently of the layers above and below them, facilitating a modular approach to the design of hardware, firmware or software components. The layers of a generic five-layer model are described below.
- Physical - the physical transmission media, connectors, and basic interconnection devices. Physical layer protocols are concerned with the design of cables and connection hardware, the electrical or optical properties of the transmission medium, and the encoding scheme used to represent data.
- Datalink - firmware that controls the transmission of data across a single network link. Functions include error handling, flow control and hardware addressing, and arbitration between network devices competing for a shared transmission medium.
- Network - software that is responsible for addressing and routing data across a network or internetwork. Network addresses and link status information are used to determine the best route through the network or internetwork.
- Transport - software that is responsible for providing error-free data transmission between applications communicating over a network. Functionality includes establishing and managing connections, error handling, flow control, and the segmentation, sequencing and re-assembly of data.
- Application - the interface between user applications and the network. Each type of application will have a specific application layer protocol to provide the required interface.
Each layer implements some part of the communications process. In some cases the same functionality (for example, error handling and flow control) is provided at different levels. The functions typically embodied in a particular set of communications protocols (sometimes called a protocol suite or protocol stack) are described below.
- Addressing - hardware devices on a local network are uniquely identified using the hardware address (sometimes called a MAC address) burned into each network adapter. A device with more than one network adapter will have multiple hardware addresses. Each network adapter may also be allocated a logical (or network) address that can be assigned by a network administrator using appropriate software. The network address is used to uniquely identify devices on both networks and internetworks, and may be part of a private or global addressing scheme used. In TCP/IP networks, the network address takes the form of an IP address.
- Process identification - although hardware and network addresses can be used to get data from one computer to another, it will also be necessary to identify the application (or process) sending the data, and the application on the destination computer for which the data is intended. A port number is therefore used together with the network address to uniquely identify both the source and the destination process.
- Encapsulation - each protocol accepts a block of data from the layer above it and adds some control information to it (in the form of a header) to create a protocol data unit (PDU). The PDU is passed to the active protocol in the next layer down, which creates its own PDU. The header information added by each protocol is only of interest to the same protocol on the destination machine. Other protocols see it simply as data.
- Connection control - connection-oriented protocols must establish a virtual connection between the two end points of a link or channel before data transfer can take place. Specific procedures must be followed to set up the connection and to manage the flow of data between the two end points. On completion of data transfer, the connection must be closed.
- Segmentation and reassembly - all networks impose a limit on how much data that can be sent in one go. This is because large amounts of data take a long time to transmit, as well as taking a long time to process both at the destination and at intermediate network switching devices. Small blocks of data can be routed quickly, do not require large storage areas (send and receive buffers), and can be processed quickly by each device they must pass through. Messages consisting of large amounts of data are therefore broken down into smaller blocks, usually called datagrams or packets. In packet-switched networks, datagrams frequently arrive at their destination out of order, and must be sequentially numbered to enable the receiving device to reassemble them in the correct order and identify missing packets.
- Flow control - a process that restricts the flow of data between two points in order to prevent the destination device receiving more data than it can process in a given time frame. The receiver may ask the sender to stop transmitting for a while or slow down the rate of data transfer. Some protocols negotiate a mutually acceptable data rate when a connection is established. The data rate may be re-negotiated if circumstances change.
- Error detection and correction - error correction requires the inclusion of sufficient redundant data to allow the receiver to reconstruct the original data if an error in transmission occurs. Error detection only requires enough redundant data to allow the receiver to detect whether or not an error has occurred, in which case it can take appropriate action (such as requesting retransmission).