Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Common Lisp bindings for Spread client API
Common Lisp
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src
test
COPYING
README.org
lift-standard.config
network.spread.asd

README.org

network.spread README

Introduction

The network.spread system provides Common Lisp bindings for the client library of the Spread group communication system.

Tutorial

Connecting

When using Spread, the first step usually consists in establishing a connection to the Spread daemon. The following example demonstrates this for a situation in which the Spread daemon is running on the local machine and listening on port 5103:

(defvar *connection* (network.spread:connect "5103"))

Receiving Messages

After a connection has been established, data can be sent and received. However, in order to receive data, it is necessary to join the Spread group to which messages are sent. In the following code, the previously created connection joins a Spread group called =”mygroup”=. The number of groups a given connection is a member of is evident from the printed representation of the connection instance.

(network.spread:join *connection* "mygroup")

After joining one ore more groups, messages can be received:

(network.spread:receive *connection* :block? nil)

Consing can be avoided by receiving into a previously allocated buffer:

(defvar *buffer* (nibbles:make-octet-vector 10000))

(network.spread:receive-into *connection* *buffer*)

Sending Messages

To send data to receivers in a Spread group, the generic functions network.spread:send and network.spread:send-bytes are used (the delegates the actual work to the latter):

(network.spread:send *connection* "mygroup" "mymessage")

Note that it is not necessary to join a Spread group in order to send messages to that group.

It is possible to send a single message to multiple groups:

(network.spread:send *connection* '("mygroup" "othergroup") "mymessage")

Settings

Something went wrong with that request. Please try again.