The server is the process running the “blackboard process”. It is an ordinary SICStus process, which can be run on a separate machine if necessary.
To load the package, enter the query
| ?- use_module(library('linda/server')).
and start the server with linda/[0,1]
.
linda
linda(
:Options)
-
GoalWhen the linda server is started, Host and Port are bound to the server host and port respectively and the goal Goal is called. A typical use of this would be to store the connection information in a file so that the clients can find the server to connect to.
For backward compatibility, if Options is not a list, it is
assumed to be an option of the form Address-
Goal.
In SICStus before 3.9.1, Goal needed an explicit module
prefix to ensure it was called in the right module. This is no
longer necessary since linda/1
is now a meta-predicate.
accept_hook(
Client,
Stream,
Goal)
Example:
| ?- linda([(Host:Port)-mypred(Host,Port), accept_hook(C,S,should_accept(C,S))]).
Will call mypred/2
when the server is started. mypred/2
could start the client-processes, save the address for the clients
etc. Whenever a client attempts to connect from a host with IP address
Addr, a bi-directional socket stream Stream will be
opened to the client, and should_accept(
Addr,
Stream)
will be called to determine if the client should be allowed to connect.