YAZ User's Guide and Reference
Prev | Chapter 4. Generic server | Next

# Application Invocation

The finished application has the following invocation syntax (by way of `statserv_main()`):

        appname [-szSiTu -a apdufile -l logfile -v loglevel -c config]
        [listener ...]

The options are

-a `file`

  Specify a file for dumping PDUs (for diagnostic purposes). The special name "-" sends output to `stderr`.

-S

  Don't fork or make threads on connection requests. This is good for debugging, but not recommended for real operation: Although the server is asynchronous and non-blocking, it can be nice to keep a software malfunction (okay then, a crash) from affecting all current users.

-T

  Operate the server in threaded mode. The server creates a thread for each connection rather than a fork a process. Only available on UNIX systems that offers POSIX threads.

-s

  Use the SR protocol (obsolete).

-z

  Use the Z39.50 protocol (default). These two options complement each other. You can use both multiple times on the same command line, between listener-specifications (see below). This way, you can set up the server to listen for connections in both protocols concurrently, on different local ports.

-l `file`

  The logfile.

-c `config`

  A user option that serves as a specifier for some sort of configuration, e.g. a filename. The argument to this option is transferred to member `configname`of the `statserv_options_block`.

-v `level`

  The log level. Use a comma-separated list of members of the set {fatal,debug,warn,log,all,none}.

-u `userid`

  Set user ID. Sets the real UID of the server process to that of the given user. It's useful if you aren't comfortable with having the server run as root, but you need to start it as such to bind a privileged port.

-w `dir`

  Working directory.

-i

  Use this when running from the inetd server.

-t `minutes`

  Idle session timeout, in minutes.

-k `size`

  Maximum record size/message size, in kilobytes.

A listener specification consists of a transport mode followed by a colon (:) followed by a listener address. The transport mode is either `osi` or `tcp`.

For TCP, an address has the form

        hostname | IP-number [: portnumber]

The port number defaults to 210 (standard Z39.50 port).

For osi, the address form is

        [t-selector /] hostname | IP-number [: portnumber]

The transport selector is given as a string of hex digits (with an even number of digits). The default port number is 102 (RFC1006 port).

Examples

        tcp:dranet.dra.com

        osi:0402/dbserver.osiworld.com:3000

In both cases, the special hostname "@" is mapped to the address INADDR_ANY, which causes the server to listen on any local interface. To start the server listening on the registered ports for Z39.50 and SR over OSI/RFC1006, and to drop root privileges once the ports are bound, execute the server like this (from a root shell):

        my-server -u daemon tcp:@ -s osi:@

You can replace `daemon` with another user, eg. your own account, or a dedicated IR server account. `my-server` should be the name of your server application. You can test the procedure with the yaz-ztest application.

Prev | Home | Next
The Backend Functions | Up | The YAZ client