The client/server relationship

Two processes have a client/server relationship when they cooperate with one another in such a way that one process responds to connection requests generated by the other.

It is important to remember that the client/server relationship has a very restricted meaning: it refers solely to how connections are established. For example, an X-Windows server controls the X-Windows client, whereas a NFS server is controlled by NFS clients. So saying processes have a client/server relationship says nothing about which process is the controlling process.

The distinction between clients and servers is based solely on how connections are established. Servers get connections by accepting connection requests, clients get connections by requesting a connection from a server.


server
a process that accepts connection requests. The server is said to listen for connections.
client
a process that requests a connection from a server.

A process can be a client to some processes, but a server to other processes. In the preceding example, the filter is a server to the producer and a client of the consumer.

A Prolog server is a Prolog process that calls the predicate tcp_create_listener/2 and then accepts connection requests. A C server is a process that calls the C function tcp_create_listener() and then accepts connection requests.

A Prolog client is a Prolog process that calls the predicate tcp_connect/2 to generate connection requests. In the same way a C client is a process that calls tcp_connect().

Although designed principally with Prolog to Prolog communication in mind, this package can be used for any combination of C or Prolog servers or clients.