Finally you can bind servers to ports. When you do so the server you created listens on the port, accepts connections and serves clients. It does so as soon as Serveez enters its main loop right after running the configuration file. Serveez won’t stop until you interrupt it (e.g., by pressing ^C in the terminal you started it in).
This example binds the server
to the port
which was described above. Therefore you need to call the procedure
bind-server! which takes two arguments specifying the name of a port
configuration and a server instance. Both need to be defined before
you can write this statement.
(bind-server! 'foo-tcp-port 'foo-server)
One of the main features of Serveez is that you can bind multiple servers to the same port. This for example is useful to pass braindead firewall configurations or proxy servers. It is also possible to bind servers to ports they are actually not designed for. This might be used for debugging servers or other funny things (again, think about the firewall). This is the point we have to warn you: Some protocols cannot share the same port (e.g., the tunnel server) and some protocols simply won’t work on ’wrong’ ports. Additionally, you will not get error messages when that happens. The server just will not work then.
The three procedures
#t on success and
#f on failure.
For your convenience we provide some more built-in procedures,
some of which are based upon those above.
Return a string made by applying
to s and args. For example:
(fs "~A-~S" 'foo 42) ⇒ "foo-42"
display on each object.
Then, output a newline.
For each object, do
display on it
and on spacer, as well. Then, output a newline.
Add interface to the list of known network interfaces. You can get the list of known interfaces by running the shell command ‘serveez -i’. The interface argument must be in dotted decimal form (e.g., ‘127.0.0.1’). Serveez provides this procedure for systems where it is unable to detect the list of network interface automatically.
Append dir… to the server modules load path.
Try to load filename (via
If filename is not absolute, search for it
in the list of directories returned by
#t if successful,
Bind all servers and ports in args to each other.
This is a cross-product operation; given s servers, and
s * p bindings will be created.
Define a new TCP port named by concatenating basename and port. Return the new name.
Bind the list of servers to simple TCP port configurations whose network ports range between from and to both inclusive.
Define a new UDP port named by concatenating basename and port. Return the new name.
Bind the list of servers to simple UDP port configurations whose network ports range between from and to both inclusive.
Return the next RPC entry as a vector of the form:
#(name aliases program-number).
name is a symbol, aliases is a list (possibly empty)
of symbols, and program-number is an integer.
If the list is exhausted, return
Return the RPC entry for name, a string. (FIXME: Should be able to handle a symbol, too.) If no such service exists, signal error.
Return the RPC entry for number, an integer. If no such service exists, signal error.
Open and rewind the file /etc/rpc.
If optional arg stayopen (an integer) is non-zero,
the database will not be closed after each call to
(or its derivatives
Close the file /etc/rpc.
Return the verbosity level (an integer). Optional arg level means set it to that level, instead. This setting is overridden by the command-line ‘-v’ option.
Return the maximum number of open sockets permitted (an integer). Optional arg max means set it to that number, instead. This setting is overridden by the command-line ‘-m’ option.
Return the control password (a string). Optional arg pw sets it to that, instead. This effectively does nothing if the control protocol is not enabled.
We now have a closer look at the internals of Serveez. If you are not interested in that have a look at the existing servers (See Existing servers.).