CL-IPC

Interprocess Calls with Common Lisp

Introduction

This is a simple CL wrapper for the libc-calls to do IPC.

Sample Client

You can build the sample client application using a simple call to GCC:
 gcc -g "sample-client.c" -o "sample-client"
The you can pass messages to a listener using
 ./sample-client -k 2222 -p "message in a bottle"

Example

After loading the CL-IPC code using
 (asdf:oos 'asdf:load-op :cl-ipc)
 (use-package :cl-ipc)
    
you can start a very simple IPC listener that will terminate when it receives the message "quit" like this:
 (do-msg-queue (message 2222)
     (format t "Received Message \"~a\"" message)
     (force-output)
     (when (string= "quit" message)
       (exit-ipc-loop)))
This will listen on the queue and evaluate the body code whenever there is a message.

If you need to do other things inbetween you can pass the argument :nowait and then test the resulting message. When it's nil the queue returned immediately without result:

 (defun idle-function ()
   ;; ...
   (sleep 1))

 (do-msg-queue (message 2222 :nowait t)
     (cond
       ((null message)
         (idle-function))
       (message
         (format t "Received Message \"~a\"" message)
         (force-output)
         (when (string= "quit" message)
           (exit-ipc-loop)))))
An that's about all there is to it.

Mailing Lists

Download

This project has not released any files. Use the CVS to checkout the module.

CVS

You can browse our CVS repository or download the current development tree via anonymous cvs, as described here