MemCom Reference Manual > The MemCom Tools and Utilities > mcserver

Name

mcserver — MemCom Server Program

Synopsis

mcserver [-d pidfile] [-l logfile] [-p tcpport] [-u pipefile] [-v] dbname

Description

mcserver is used for running MemCom in client/server mode. mcserver receives requests from MemCom clients, processes them, and sends back the results. A MemCom client is any program using the MemCom library and opening a database in client/server-mode (see below for connecting a client to the server).

Parameters

-d pidfile

Optional parameter indicating that mcserver should run in the background. pidfile is the name of the file where the process number will be written to.

-l logfile

Dump debug and error messages to logfile. Useful in combination with the -d option.

-p tcpport

Set up a listening socket on TCP port tcpport. This enables clients from remote hosts to connect to the server.

-u pipefile

Create a UNIX named pipe called pipefile and set up a listening socket on this file. This enables clients running on the same host to connect to the server.

-v

Dump debug messages. Not used for normal operation.

Communication Protocols

The communication between clients and the server can take place in two different ways:

  • Using UNIX domain sockets if client and server reside on the same host. This is a secure and very efficient inter-process communication mechanism. Client and server communicate via a named pipe, a special file.

  • With TCP sockets when client and server are located on different hosts. The Transmission Control Protocol (TCP) provides reliable and efficient data transport between different hosts over an intranet or the Internet. Client and server communicate via a TCP port, which is an integer number ranging between 1 and 65535.

Connecting from a Client to the Server

When mcserver is started, it retains the current working directory and the credentials of the parent process. This means that mcserver treats relative file names (file names that do not begin with a "/") relative to its working directory, and that the permissions are those of the user that started mcserver. The database name recognised by the functions mcDBopenFile, mcDBopenFileBuffered, and mcDBisFile must be specified as follows:

  • When in direct access mode, i.e without a server) the database name must consist of a valid UNIX path of the form /absolute/path/to/the/database or ../../relative/path/to/the/database.

  • When using TCP sockets the database name must consist of the host name, the TCP port number, and the path, each of them separated by a colon ":" character. Examples: toto:2000:database anothertoto:1555:/absolute/path/to/the/database or anotherhost:1555:../../relative/path/to/the/database

  • With UNIX domain sockets the host name is omitted and the port number is replaced by the name of the path to the UNIX named pipe. Examples: :/path/to/named-pipe:path/to/the/database or :/path/to/another/named-pipe:/absolute/path/to/the/database

The appropriate access method is selected as a function of the name.