Client and server socket programs

The terms client and server are common within the TCP/IP community, and many definitions exist. In the TCP/IP context, these terms are defined as follows:

Server
A process that waits passively for requests from clients, processes the work specified, and returns the result to the client that originated the request.
Client
A process that initiates a service request.

The client and server distribution model is structured on the roles of master and slave; the client acts as the master and requests service from the server (the slave). The server responds to the request from the client. This model implies a one-to-many relationship; the server typically serves multiple clients, while each client deals with a single server.

No matter which socket programming interface you select, function is identical. The syntax might vary, but the underlying concept is the same.

While clients communicate with one server at a time, servers can serve multiple clients. When you design a server program, plan for multiple concurrent processes. Special socket calls are available for that purpose; they are called concurrent servers, as opposed to the more simple type of iterative server.

To distinguish between these generic socket program categories, the following terms are used:

  • Client program identifies a socket program that acts as a client.
  • Iterative server program identifies a socket program that acts as a server, and processes fully one client request before accepting another client request.
  • Concurrent server main program identifies that part of a concurrent server that manages child processes, accepts client connections, and schedules client connections to child processes.
  • Concurrent server child program identifies that part of a concurrent server that processes the client requests.

In a concurrent server main program, the child program might be active in many parallel child processes, each processing a client request. In an MVS™ environment, a process is either an MVS task, a CICS® transaction, or an IMS transaction.