server (in Serveez) is a snippet of code that implements some
protocol. There are many servers built into Serveez but you can implement
your own, too. For example we provide a webserver implementing the
Hypertext Transfer Protocol (HTTP). Each server has a different set of
options you can change. You can have many instances of every server, each
with a different set of options. For example: You can create a webserver
on TCP port 42420 publishing the Serveez documentation and also have another
webserver on a different port publishing something else. Every server
has a unique name you assign to it. The name of the server is later used
to bind it to a port.
The following example instantiates a server with the short name “foo”. Each
server in Serveez has got a short name. See Existing servers, for the
details. This example demonstrates everything which is possible in server
configurations. You start a definition of a server with the procedure
define-server!. The following argument specifies the name of the
server instance (in this case
foo-server) which starts with the short
name. The second argument describes the server in detail. Each
configuration item is setup with a
(key . value) pair where key is
the name of the configuration item and value is the value which depends
on the type of the item. See Some words about server configuration, for a detailed
description of each type of value.
(define-server! 'foo-server '( (bar . 100) ;; number (reply . "Booo") ;; character string (messages . ;; list of strings ("Welcome to the foo test server." "This one echos your lines.")) (ports . (5 6 7 8 9)) ;; list of numbers (port . foo-tcp-port) ;; a port configuration (assoc . (( "GNU" . "great" ) ;; associative list ( "Tree" . "tall" ))) (truth . #f) ;; boolean value ))
Serveez provides a number of server types. Each of them has a short name.
The name of the server instance has to begin with this short name followed
by a dash (-). You can append any suffix then. In the example above “foo”
is the short name and
foo-server the name of the server instance.