TCP/IP model

The TCP/IP model is a description of a protocol suite, which is a collection of protocols that are designed to work together to transfer data from one computer to another. It is named after two of the main protocols (TCP and IP). TCP/IP is considered the de-facto standard protocol today and has replaced older protocol suites, such as IPX and SPX. The TCP/IP protocol suite can be broken down into a 4-layer model shown in the following image:

Most modern networking courses teach the 7-layer OSI model. The OSI model is an idealized networking model and, as of yet, not a practical implementation.

The four layers are broken down into the application layer, the transport layer, the networking layer, and the datalink layer. The application is the layer that represents the data to the user and handles the encoding and dialog control. A commonly known application layer protocol is the Hyper Text Transfer Protocol (HTTP), which is the protocol that powers the websites we all use daily. The transport layer, also known as the host-to-host layer, is the layer that supports the lower level communications between various devices and networks, independent of the hardware being used. We will dive deeper into this layer next. The networking layer is the layer that determines the best path for the data through the network and handles addressing. The most common protocol in this layer is Internet Protocol (IP). There are two versions of IP: the IPv4 standard, and the IPv6 standard. The fourth and final layer is the datalink or network access layer. The datalink layer specifies the hardware devices and media that make up the network. Common datalink protocols are Ethernet and Wi-Fi.

Now that we have a general understanding of the layers, let's take a closer look at the two most commonly used networking layer protocols in game development: TCP and UDP.