A computer network refers to a set of devices (computers, routers, applications) that can communicate with each other. They rely on network protocols to be able to communicate with each other (a shared language).

Basics

Data is primarily communicated across a network in packets. Individual data packets often wrap a header (and maybe a footer) according to a protocol specification. This core idea is called data encapsulation. For example:1 As the packet is received, each level of wrapper is successively stripped away. The Ethernet data is stripped by the hardware adapter, then the kernel strips the IP/UDP headers, and then the TFTP program strips away the TFTP header to get the data. When the data is sent, this order is performed in reverse.

Layered network model

This allows us to make an important abstraction for network programming: the layered network model. In this model, the programmer can write software without thinking about how the data is physically transmitted because it’s taken care of at lower levels. In other words, the hardware and network topology is not relevant to the programmer.

The ISO reference layered network model has the following layers:

  • Application — supports networked applications.
  • Presentation — allows applications to interpret the meaning of data (i.e., encryption, compression, machine-specific conventions).
  • Session — synchronisation, checkpointing, recovery of data exchange.
  • Transportprocess to process data transfer.
  • Network — routing of datagrams from source to destination.
  • Data link — data transfer between neighbouring network elements (i.e., Ethernet, WiFi).
  • Physical — bits on the wire.

Where Unix mainly has the application layer, host-to-host transport layer, Internet layer, and network access layer (more physical layers of the stack). The Internet protocol stack is missing the presentation/session layers, so if these services are needed, they have to be implemented in the application.

Sub-pages

Resources

See also

Footnotes

  1. From Beej’s Guide to Network Programming.