Client-Server Architecture

The client-server architecture (CSA) is a system that hosts, delivers, and manages most of the resources and services that the client request. The server typically listens for incoming client connections on a specific port.

Figure 3.1 The client-server model.

Figure 3.1 The client-server model.

Once a connection is established, the server and client can exchange data using sockets created through the Socket API. The Socket API provides a set of functions and methods that simplify network communication and management. The two primary network services provided are:

  1. Transmission Control Protocol (TCP): Ensures reliable, ordered, and error-checked delivery of data between applications.
  2. User Datagram Protocol (UDP): Offers lightweight, low-latency data transmission without the reliability guarantees of TCP.

Each of these protocols has its advantages and disadvantages, which we will discuss in detail. These characteristics make them suitable for specific types of applications and scenarios.

Socket API and Port

If you remember from the previous notes, a host can support one or more application. This is achieved by running multiple sockets. To provide some visual context, consider the application layer and the transport layer.

Figure 3.2a Application and Transport Layer.

Figure 3.2a Application and Transport Layer.

When we run multiple applications on a single host, the Socket API creates and manages distinct sockets, each associated with a unique port number — acts as a form of addressing.

Figure 3.2b Socket API.

Figure 3.2b Socket API.

Port numbers can range from $0$ to $65535$, however, not all of these port numbers are available for general use.

  1. Well-Known Ports ($0-1023$): These port numbers are reserved for well-known services and protocols.
  2. Registered Ports ($1024-49151$): These port numbers can be used by network users and/or applications with no administrative privilege.
  3. Dynamic or Private Ports ($49152-65535$): These port numbers are available for use by applications and services on a more ad-hoc basis.