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
Starts a Linda-server in this SICStus. The network address is written to the current output stream as Host:PortNumber.
Starts a Linda-server in this SICStus. Each option on the list Options is one of
where Address must be unifiable with Host:Port and Goal must be instantiated to a goal.
When 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, then it is
assumed to be an option of the form
Before release 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.
When a client attempts to connects to the server Client and Stream will be bound to the IP address of the client and the socket stream connected to the client, respectively. The Goal is then called, and if it succeeds, then the client is allowed to connect. If Goal fails, then the server will close the stream and ignore the connection request. A typical use of this feature would be to restrict the addresses of the clients allowed to connect. If you require bullet proof security, then you would probably need something more sophisticated.
| ?- linda([(Host:Port)-mypred(Host,Port), accept_hook(C,S,should_accept(C,S))]).
mypred/2 when the server is started.
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
will be called to determine if the client should be allowed to connect.