Network Communication and the Client-Server Model

The client server model is the most ubiquitous networking model in use today, simply because it is the backbone of the largest computer network ever constructed, the Internet. We take a detailed look at the workings of the client-server model and the architecture of its key protocols.

Before looking in detail at how the client-server model operates, and at the various protocols that make up the Internet as we know it, we need to first get a grounding on the components that make up a communications system. The OSI (Open Systems Interconnection) model of communication is a way we can do this. It is a conceptual model that partitions the various elements of a communication system into distinct layers. The model serves to show how you can implement data communication across co-operating systems. The OSI model breaks the communications system down into seven layers, as follows:

  • Application Layer – Provides end-user applications.
  • Presentation Layer – Translating the information to be exchanged into terms that are understood by the end systems.
  • Session Layer – For the establishment, maintenance, and termination of connections.
  • Transport Layer – For reliable transfer of data between end systems.
  • Network Layer – For routing the data to its destination and for network addressing.
  • Data Link Layer – Preparing data in frames for transfer over the link and error detection and correction in frames.
  • Physical Layer – Defining the electrical and mechanical standards and signaling requirements for establishing, maintaining and terminating connections.

OSI Model

Keep in mind that, as an application developer, you’ll basically only ever learn how to work with the most abstract layer, the Application Layer, unless you’re a specialist network programmer or developing software that has very specific networking requirements.

There is another reference model commonly used in computing networking, the Internet architecture model. The Internet layer model is as follows:

  • Application layer – This layer describes the applications and technologies used to provide end-user services.
  • Transport(host-to-host) layer = Two protocols at this layer are defined – the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP). TCP is a connection-oriented protocol that permits the reliable transfer of data between the source and destination end users. UDP is a connectionless protocol that offers neither error recovery nor flow control.
  • Internet layer – The Internet Protocol (IP) defined for this layer is a simple connectionless datagram protocol. It offers no error recovery and any error packets are simply discarded.
  • Network Access(Link) layer – Relies on the data link and physical layer protocols of the appropriate network, no specific protocols are defined.

You can see how the Internet model stacks up against the OSI architecture for general communications networks.

Internet model

The “DARPA Internet Protocol Suite”, or more commonly referred to as the TCP/IP protocol suite (or just TCP/IP) is a collection of protocols from the 4 Internet layers (plus the physical layer) that forms the basis of the Internet. A collection of protocols such as this is known as a protocol suite or protocol family.

TCP/IP suite

The Internet Protocol (IP)

The Internet Protocol (IP) is connectionless and inherently unreliable. It is based on Internet datagrams. A datagram is up to 64k bytes long and may be part of a longer message. Each datagram is transmitted over the network independently, thus making the communication truly connectionless.

During transmission, a datagram may be lost or may be further fragmented into smaller units (referred to as IP packets) as it goes through the protocol layers.

When all the IP packets of a datagram finally arrive at their destination, they are then reassembled to form the datagram and transferred to the transport layer of the destination site.

If any of the IP packets of a datagram are lost or corrupted, the entire datagram is discarded by the destination site. The IP protocol is therefore unreliable because it cannot guarantee the delivery of a program.

The below picture outlines the structure of an IP datagram.

IP datagram

You can see that the IP datagram contains a 32-bit source and destination address, each encoding both a network ID number and a host ID number. Every single host on a TCP/IP network (the Internet) must have a unique Internet (IP) address.

Transport Layer: TCP and UDP

The two transport layer protocols of the Internet protocol suite are TCP and UDP. TCP provides a connection-oriented, reliable, full-duplex, byte-stream service, similar to a virtual circuit, to an application program. UDP provides a connectionless, unreliable datagram service to an application program.

A 16-bit integer (port number) is used for identifying data associated with each user process. So the following 5-tuple uniquely identifies a communication between two processes that may run on two different computers:

  • The protocol (TCP or UDP)
  • The local computer’s Internet address
  • The local port number
  • The foreign computer’s Internet address
  • The foreign port number

For example: {tcp, 139.120.119.101, 5100, 124.130.118.4, 5101}.

Port numbers 1 through 255 are reserved. All well-known ports (such as very commonly used utility programs) are in this range of port numbers. For example, the File Transfer Protocol (FTP) server uses the well-known port number 21. Some operating systems also reserve additional ports for privileged uses. For example, many Unix/Linux systems reserve ports 1 through 1023 for superuser processes, leaving only port numbers 1024 and higher available to be assigned to user processes.

Both TCP and UDP protocol entities accept arbitrarily long messages from user processes, break them into datagrams of up to 64k bytes, and send them to the IP (Internet Protocol) layer. The TCP protocol establishes a connection between the sender and the recipient, and after the communication ends, the connection is terminated. Note that the IP layer itself does nothing to guarantee the proper delivery of a datagram; it is the sole responsibility of the TCP transport layer to ensure that a datagrams arrives at the destination properly using time-out and retransmission techniques. It is also the TCP protocol’s responsiblity to ensure that datagrams at the destination are not jumbled out of order. If they are, the TCP protocol has the responsibility to reassemble the datagrams into the proper sequence.

Each datagram submitted by the TCP to IP layer contains a TCP header and a data portion. The whole TCP datagram is viewed by the IP as data only and an IP header is added to form an IP datagram. The TCP header contains the source port number, destination port number, sequence number, and other related information.

The TCP protocol has a very well defined service interface. There are primitives used to activity and passively initiation connections, to send and receive data, to gracefully and abruptly terminate connections, and to check the status of connections.

In contrast, the UDP protocol is connectionless so no guarantee is given of delivery or sequencing of datagrams. In effect, UDP is simply a user interface to the Internet Protocol (IP).

Ports

Ports, or addresses within a computer, are used to enable communication between programs. An application server, such as a Web server or FTP server, listens on a particular port for a service requests, performs whatever service is requested of it, and returns information to the port used by the application program requesting the service.

What is the Internet?

The Internet, then, can be defined as ‘the collection of all computers that can communicate using the Internet Protocol Suite, with the participating computers and networks registered with the Internet Network Information Center (InterNIC).’ The Internet Protocol enables communication between computers on the Internet by routing data from a source computer to a destination computer.

This definition includes all computers to which you can directly send Internet Protocol packets (or indirectly, through a firewall).

The Next Generation Internet Protocol: IPv6

The current version of the Internet Protocol (IP) is rapidly becoming obsolete, and the Internet Engineering Task Force has developed an updated version of it, known as IPv6, which is expected to completely replace the use of IPv4 over the next decade.

The primary motivation for the change from IPv4 (the current standard in IP addressing used today) to IPv6 is the limited and rapidly diminishing available address space. The 32-bit IP address can only include over a million networks in the Internet. At the current growth rate, each of the possible network prefixes will soon be assigned and no further growth will be possible.

The second motivation for the change comes from the requirements of new types of applications, especially applications that require real-time delivery of audio and video data. The current IP has limited capabilities for routing real-time data. The current IP was also not designed with such modern technologies as mobile and ubiquitous Internet in mind, so IPv6 has extra functionality to provide more advanced end-to-end encryption, data integrity and authentication features.

Let’s have a look at what an IPv6 header looks like. Note that an IPv6 address is 128 bits as opposed to the currently used 32 bit IP address.

IPv6

Some further characteristics of IPv6 are:

  • Almost unlimited address space, as an IPv6 address is 128 bits
  • Simplification of packet headers
  • Optional header fields (better support for options and customisation)
  • More security features and greater support for authentication
  • More Plug & Play options

The Client-Server Model

Before we get into a detailed explanation of what exactly constitutes the client-server model, let’s define the key terms in the phrase:

Client: A client is a software entity that connects to servers and uses or consumes services provided by them. A client can but does not have to interface directly with a human user.

Server: A server is an instance of a particular service running on a single machine.

Service: A service is a software entity that runs on one or more machines. It provides an abstraction of a set of well-defined operations.

Let’s look at the physical implementation of the client-server model. You can see that communication between a client and server revolves around a request sent by the client which results in a response sent by the server.

client-server model

The client-server model has the distinct advantages of being simple to implement and conceptualise, modular, extensible and flexible. By modular and extensible, we mean that the client-server concept does not have to be limited to a single client and a single server – the concept can be extended to a myriad of configurations, allowing for great flexibility in the types of networks that can be built. For example, a printer server that provides services to multiple clients, or a chain of co-operating servers all providing services.

Another type of extension that can be applied to the client-server model is the agent model, in which a simple or complex agent is added as an additional layer between the client and server process, acting as a mediator between the two, helping to resolve data transfer, manage resources and ensure the co-operation between servers.

client-server model

The most well known and most used extension to the client-server model is the three-tier (n-tier) client server architecture.

Three-tier architecture is a type of client–server architecture in which the user interface, application logic (“business rules”), data storage and data access are developed and maintained as independent modules, usually on separate platforms.

The user interface or client tier is responsible for accepting inputs and presenting the results to the user.

The application or computational function processing tier is responsible for providing transparent, reliable, secure and efficient distributed computing. It is also responsible for performing the necessary processing to solve a particular application problem.

The data access, or back-end tier is responsible for accessing, retrieving and storing data on external storage devices (such as a database on a hard drive).

3 tier model

The three tier (or n-tier) client-server architecture usually employs middleware services, a layer of software services in between communicating software applications that allows each application to access a layer of services they would not otherwise have access to. Examples of middleware services are directory services, security services, time and transaction services.

The client-server model also allows for interoperability, meaning the ability of two or more software components to co-operate and communicate despite differences in language, interface and execution platform. There are two aspects of client-server interoperability. The first is a unit of interoperation, a piece of data that needs to be shared among two disparate systems, and the second is an interoperation mechanism, a mechanism that maps client and server interfaces to a common representation and provides a two-way mapping to the client and server.

Communication Mechanisms between Clients and Servers

There is a set of broad factors that influence the performance of a client-server network. They are, in no particular order:

  • The speed of a network, ranging from slow (10 Mbps) to extremely fast (up to 100 Gbps).
  • The communication protocols which span the connection-oriented protocols such as OSI and TCP which generate considerable overhead to specialised fast protocols.
  • The communication paradigm – the communication model supporting co-operation between clients and servers and a communication facility provided to deal with the co-operation. For example, is the communication one-to-one (between one client and one server), or one-to-many (between one client and many servers)?

Interprocess Communication Techniques

Message Passing

Message-oriented communication is a form of communication in which the user is explicitly aware of the message used in communication and the mechanisms used to deliver and receive messages. The basic message passing primitives are:

  • send(dest,src,buffer) – The execution of this primitive sends the message stored in buffer to a server process named dest. The message contains the name of a client process named src to be used by the server to send a response back.
  • receive(client,buffer) – The execution of this primitive causes the receiving server process to be blocked until a message arrives. The server process specifies from whom a message is desired by providing the client name of a process, and provides a buffer to store an incoming message.

the message-passing model

There are several semantically different types of message passing:

  • Blocking versus nonblocking primitives
  • Buffered versus unbuffered primitives
  • Reliable versus unreliable primitives

The term ‘blocking’ in this context refers to whether or not the application process stops and waits after a command or continues processing as normal. For example, in a blocking send process, the sender would stop and pause all processing after sending a message to wait for a response. In a nonblocking send process, the sender would send the message and continue the rest of its processing as normal, not concerned with whether a response is received or not. The following diagram outlines the differences between blocking and nonblocking send primitives:

There is also a difference between buffered and unbuffered primitives.

Buffered message passing systems are more complex than unbuffered message passing systems, since they require the creation, destruction and management of buffers. Buffered message passing systems also generate protection problems, and can cause catastrophic event problems, if a process owning a port dies or is killed.

Unbuffered message passing requires synchronisation (rendezvous) for a message transfer to take place.

The final semantic difference is between reliable and unreliable primitives. A reliable send primitive handles lost messages using internal retransmissions, and acknowledgements on the basis of timeouts. An unreliable primitive receive operation, for example, does not send an acknowledgement confirming receipt of a message.

Remote Procedure Call (RPC)

The RPC technique is based on the fundamental linguistic concept known as the procedure call. The very general term ‘remote procedure call’ means a type-checked mechanism that permits a language level call on one computer to be automatically turned into a corresponding language-level call on another computer.

The typical execution of a remote procedure call is


call service_name (value_args, result_args)

For example, let’s take a look at this diagram of a typical RPC read call, in which the method parameters are packed and unpacked by the client and then the server. The server provides a return to the client’s request.

You may also like...