Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

Server Mode

Any slisp application may be run in server mode by starting it with the -s flag. The -s flag causes the application to supress the initial prompt, and to enclose output in control character delimiters that allow the client to disambiguate error and other output from the value returned by the function.

The program can be made into a network accessible server by including it as one of the programs known to the internet superserver inetd. The operations for accomplishing this must be done by root on the server machine. The following operations use as an example the creation of a server for the basic slisp application sl, on port 5201:

1. Read about inetd and services by doing man inetd and man services.

2. Choose a port number, an application name (usually the name of the executable), and a user under whom the application should run. Port numbers above 5000 are usually safe. The user should not be root since slisp contains the "system" command which under root could do almost anything. An ordinary user is usually best, or one that is created for the server.

3. Make an entry in /etc/services for the port number, application name and protocol (tcp). For example, to run the basic slisp applications sl as a server on port 5201:

sl	5201/tcp

4. Make an entry in /etc/inetd.conf to tell inetd which program to run when a connection is made on the given port with the service name defined in /etc/services:

sl      stream  tcp     nowait  slisp  /usr/localbin/sl  sl -s

The fields are separated by spaces or tabs. For this example the fields are:a) sl - the name of the service defined in /etc/services b) stream, tcp and nowait - should always be set to these for this protocol c) slisp - the name of the user under which the server should run. Here we've created a pseudo user called slisp, d) /usr/localbin/sl, the pathname to the executable - note this can be the executable shell script. Environment variables set by the shell script are remembered by the server, e) sl - The first argument, always the name of the executable, f) -s - any remaining arguments.

The appropriate man pages have more information.

Go to the first, previous, next, last section, table of contents.