# TCP/IP #3: Network messaging

Communication between devices on packet-switched networks is based on items most generically called messages. These pieces of information also go by other names such as packets, datagrams, frames, and cells, which often correspond to protocols at particular layers of the OSI Reference Model. The formal OSI terms for messages are protocol data unit (PDU) and service data unit (SDU).

Every protocol uses formatting that determines the structure of the messages it employs. The format of the particular message will vary, depending on protocol/technology that uses it. Despite there are some differences, each message contains the following three elements:

This information is placed at the beginning of the message. It normally contains a small number of control bytes, which tells general information how this chunk of data should be treated and interpreted. Headers are links between protocol elements on different services.

### Data

Often called also payload. This is actual part of information which is sent, eg. website contents. But sometimes messages contains no data. This is due to control and communication purposes. One of the application of empty data/payload is terminating connections.

### Footer

This information is at the end of the message. Footer is very similar to Header, however it is in different place. The header is present in the most protocol messages, but footer only in some (especially in lower-layer protocols, as data link layer is OSI model).

The general format of networking message consists three parts in the following order: header, data and footer. Header and footer consists control information, data itself it’s ‘packed’ into the middle.

### Message Addressing and Transmission Methods

Like real world, in the networking there are also several ways of addressing and transmitting information. They vary on the amount of recipients, knowledge about who are the recipients and information about the party which is a recipient. Consider situation, where there is a large hall with a few hundred people in there. They are mingling ang having different conversations. Hence you may try to send messages to them in different ways. Bearing this analogy in mind, consider below three kinds of transmission and addressing types:

### Unicast

These messages are sent by one party to another and they are not intended to others. If you want to share some confidential information during a party, you will ask a friend to go with you when you will not be heard by others. Obviously, there is a possibility to eavesdrop on it. Same in the web – using this type of transmission does not guarantee confidentiality.

Unicast delivery requires that message should be sent to specific recipient. This is the most common type used on the network.

As the name suggests, those messages are sent to the whole audience. It is like listening a music in one room – it is just a matter of somebody’s will to hear the music. While you should not use it to send any sensitive messages, you can use it to reach some party which you do not know how to reach. Broadcasting is used for a variety of purposes, including finding the locations of particular devices on the network that manage different services.

Broadcasts are usually implemented via special broadcasting address which sends the data into the network. Whoever wants to receive those data, only have to listen on specific place in network.

### Multicast

These are a compromise between the previous two types. Multicast messages are sent to some group of specified recipients. It can be compared to talking with a small known group on the party. This type requires some kind of authentication who is allowed to see those messages.

Addressing in multicast is the most complicated, since they requires to broadcast data with some kinf of authentication.

### Point-to-point & anycast

There is also point-to-point network type of addressing which links only two messages. Thus there are only two parties, no strict addressing are necessary. Another type worth mentioning here is anycast defined as a part of IPv6. This term identifies a message that should be sent to the closest (thus in theory the best) member of a group of devices.